Reputation: 7792
I'm trying to update a Prime Faces PickList with a RemoteCommnad and I'm getting a javax.el.PropertyNotFoundException: Property 'updatePermissions' not found
exception when the updatePermission
property is defined.
This is my UI definition file:
<h:form>
...
<h:selectOneMenu id="groupsList" value="#{permissionsToGroupsBean.selectedGroup}" title="Select Group" onclick="updatePermissions()">
<f:selectItems value="#{permissionsToGroupsBean.allGroups}" />
</h:selectOneMenu>
....
<p:pickList
id="permissions"
value="#{permissionsToGroupsBean.permissionsPickList}"
var="permissionsPickList"
itemLabel="#{permissionsPickList}"
itemValue="#{permissionsPickList}" />
....
</h:panelGrid>
<p:remoteCommand name="updatePermissions" actionListener="#{permissionsToGroupsBean.updatePermissions}" update="permissions"/>
This the controller that is supposed to handle the UI:
public class PermissionsToGroupsBean implements Serializable {
...
public void updatePermissions() {
getPermissionsPickList().setTarget(getPermissionsForSelectedGroup());
}
}
When I access the page URL I get:
javax.el.PropertyNotFoundException: Property 'updatePermissions' not found on type tld.company.admin.web.bean.PermissionsToGroupsBean
javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:193)
javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:170)
javax.el.BeanELResolver.property(BeanELResolver.java:279)
javax.el.BeanELResolver.getValue(BeanELResolver.java:60)
com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
org.apache.el.parser.AstValue.getValue(AstValue.java:118)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:214)
com.sun.faces.facelets.el.ELText$ELTextComposite.toString(ELText.java:155)
com.sun.faces.facelets.compiler.CommentInstruction.write(CommentInstruction.java:77)
com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
Any help greatly appreciated, thanks.
Upvotes: 1
Views: 5199
Reputation: 7792
Found it ... the problem was that Prime Faces doesn't handle comments for some reason ...
I had a commented out action listener defined under the one I posted in the question:
<p:remoteCommand name="updatePermissions" actionListener="#{permissionsToGroupsBean.updatePermissions}" update="permissions"/>
<!-- <p:remoteCommand name="updatePermissions" update="permissions">
<f:setPropertyActionListener value="#{selectedPermissions}" target="#{permissionsToGroupsBean.updatePermissions}" />
</p:remoteCommand> -->
As soon as I removed it it worked.
A signature with void
return type and no parameters works:
public void updatePermissions() {
getPermissionsPickList().setTarget(getPermissionsForSelectedGroup());
}
Upvotes: 5
Reputation: 88727
actionListener="#{permissionsToGroupsBean.updatePermissions}"
Im not familiar with the current version of PrimeFaces but generally the
actionListenerproperty would be expected to return an object that implements the
ActionListenerinterface. Thus your expression would be resolved to
getUpdatePermissions()` which doesn't exist and thus you get that message.
If you added that method you should see that there's another problem with the return value not being an ActionListener
.
Does the <p:remoteCommand>
tag support an action
property instead?
Upvotes: 1