“未找到财产”使用 PrimeFaces 远程命令
我正在尝试使用 PickList http://www.primefaces.org/showcase/ui/remoteCommand.jsf" rel="nofollow">RemoteCommnad ,我收到一个 javax.el.PropertyNotFoundException:定义
异常。updatePermission
属性时,未找到属性“updatePermissions”
这是我的 UI 定义文件:
<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"/>
这是应该处理 UI 的控制器:
public class PermissionsToGroupsBean implements Serializable {
...
public void updatePermissions() {
getPermissionsPickList().setTarget(getPermissionsForSelectedGroup());
}
}
当我访问页面 URL 时,我得到:
javax.el.PropertyNotFoundException:在类型 tld.company.admin 上找不到属性“updatePermissions”。 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) 。
非常感谢任何帮助,谢谢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
找到了...问题是 Prime Faces 由于某种原因不处理评论...
我在问题中发布的操作侦听器下定义了一个注释掉的操作侦听器:
一旦我将其删除,它就起作用了。
具有
void
返回类型且无参数的签名有效: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:
As soon as I removed it it worked.
A signature with
void
return type and no parameters works:actionListener="#{permissionsToGroupsBean.updatePermissions}"
我不熟悉当前版本的 PrimeFaces,但通常
actionListener属性应该返回一个对象,该对象实现
ActionListener接口。因此,您的表达式将被解析为不存在的 getUpdatePermissions()`,因此您会收到该消息。
如果您添加了该方法,您应该会看到另一个问题,即返回值不是
ActionListener
。
标记是否支持action
属性?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 anaction
property instead?updatePermissions(ActionEvent e) ?
updatePermissions(ActionEvent e) ?