Foren
MethodNotFoundException: getRegionId not found
Laxman Deepak, geändert vor 8 Jahren.
MethodNotFoundException: getRegionId not found
Junior Member Beiträge: 48 Beitrittsdatum: 11.11.14 Neueste Beiträge
Hello,
To get regionID i am using the following code
but in run time i am getting
Caused by: javax.el.MethodNotFoundException: Method getRegionId not found
2015-05-18 14:31:13,920 INFO [stdout] (ajp-executor-threads - 15) at javax.el.BeanELResolver.findMethod(BeanELResolver.java:715)
2015-05-18 14:31:13,921 INFO [stdout] (ajp-executor-threads - 15) at javax.el.BeanELResolver.invoke(BeanELResolver.java:466)
2015-05-18 14:31:13,921 INFO [stdout] (ajp-executor-threads - 15) at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:246)
2015-05-18 14:31:13,921 INFO [stdout] (ajp-executor-threads - 15) at org.apache.el.parser.AstValue.getValue(AstValue.java:159)
To get regionID i am using the following code
<%
Region region = null;
try{
if(regionId>0){
region = RegionUtil.findByPrimaryKey(regionId);
pageContext.setAttribute("region", region);
}
}catch(Exception e){
}
%>
<aui:select name="regionId" label="" inlinefield="true">
<c:if test="${region!=null}">
<aui:option value="[b]${region.getRegionId()}[/b]" selected="true">${region.getName()}</aui:option>
</c:if>
</aui:select>
but in run time i am getting
Caused by: javax.el.MethodNotFoundException: Method getRegionId not found
2015-05-18 14:31:13,920 INFO [stdout] (ajp-executor-threads - 15) at javax.el.BeanELResolver.findMethod(BeanELResolver.java:715)
2015-05-18 14:31:13,921 INFO [stdout] (ajp-executor-threads - 15) at javax.el.BeanELResolver.invoke(BeanELResolver.java:466)
2015-05-18 14:31:13,921 INFO [stdout] (ajp-executor-threads - 15) at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:246)
2015-05-18 14:31:13,921 INFO [stdout] (ajp-executor-threads - 15) at org.apache.el.parser.AstValue.getValue(AstValue.java:159)
Miroslav Ligas, geändert vor 8 Jahren.
RE: MethodNotFoundException: getRegionId not found (Antwort)
Regular Member Beiträge: 152 Beitrittsdatum: 29.07.14 Neueste Beiträge
I tested your code on Liferay 6.2 and the only problem is that you are using a wrong RegionUtil. The class you are using can be used only from persistence layer. You want to use the com.liferay.portal.service.RegionServiceUtil instead. After the change in the code the example started to work for me and I never got the exception you provided.
You maybe need to add the jstl libs in portal-plugin-package.properties
This code worked for me:
Also when using el expression you may want to conciser to set the attributes in portal class to keep the MVC separation.
You maybe need to add the jstl libs in portal-plugin-package.properties
portal-dependency-jars=\
jstl-api.jar,\
jstl-impl.jar,\
This code worked for me:
<%
try{
if(regionId>0){
region = RegionServiceUtil.getRegion(regionId);
pageContext.setAttribute("region", region);
}
}catch(Exception e){
}
%>
<aui:select name="regionId" label="" inlinefield="true">
<c:if test="${not empty region}">
<aui:option value="[b]${region.regionId}[/b]" selected="true">${region.name}</aui:option>
</c:if>
</aui:select>
Also when using el expression you may want to conciser to set the attributes in portal class to keep the MVC separation.
Thiago Leão Moreira, geändert vor 8 Jahren.
RE: MethodNotFoundException: getRegionId not found
Liferay Legend Beiträge: 1449 Beitrittsdatum: 10.10.07 Neueste Beiträge
You should use ${region.regionId} instead of ${region.getRegionId()}
Laxman Deepak, geändert vor 8 Jahren.
RE: MethodNotFoundException: getRegionId not found
Junior Member Beiträge: 48 Beitrittsdatum: 11.11.14 Neueste Beiträge
Thanks to both
Madhu Yadav, geändert vor 8 Jahren.
RE: MethodNotFoundException: getRegionId not found
New Member Beiträge: 3 Beitrittsdatum: 30.10.14 Neueste Beiträge
seems there is a conflicting variable with the same name in the theme..
OR maybe this in the theme javascript..
renaming the one in the portlet resolved the issue
though the suggestions of using Service API and JSTL are helpful and had been already suggested to the dev
#set ($region = $request.getSession().getAttribute("region"))
OR maybe this in the theme javascript..
var region = "$region";
renaming the one in the portlet resolved the issue
though the suggestions of using Service API and JSTL are helpful and had been already suggested to the dev