gpt4 book ai didi

java - "Property not found"与 PrimeFaces RemoteCommand

转载 作者:行者123 更新时间:2023-11-29 06:44:41 25 4
gpt4 key购买 nike

我正在尝试更新 Prime Faces PickListRemoteCommnad当定义了 updatePermission 属性时,我得到了一个 javax.el.PropertyNotFoundException: Property 'updatePermissions' not found 异常。

这是我的 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 的 Controller :

public class PermissionsToGroupsBean implements Serializable {

...

public void updatePermissions() {
getPermissionsPickList().setTarget(getPermissionsForSelectedGroup());
}
}

当我访问页面 URL 时,我得到:

javax.el.PropertyNotFoundException:在类型 tld.company.admin.web.bean.PermissionsToGroupsBean 上找不到属性“updatePermissions”
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.E​​LText$ELTextVariable.toString(ELText.java:214)
com.sun.faces.facelets.el.E​​LText$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)

非常感谢任何帮助,谢谢。

最佳答案

找到了……问题是 Prime Faces 出于某种原因不处理评论……

我在问题中发布的下面定义了一个注释掉的 Action 监听器:

<p:remoteCommand name="updatePermissions" actionListener="#{permissionsToGroupsBean.updatePermissions}" update="permissions"/>

<!-- <p:remoteCommand name="updatePermissions" update="permissions">
<f:setPropertyActionListener value="#{selectedPermissions}" target="#{permissionsToGroupsBean.updatePermissions}" />
</p:remoteCommand> -->

我一删除它,它就起作用了。

具有 void 返回类型且没有参数的签名有效:

public void updatePermissions() {
getPermissionsPickList().setTarget(getPermissionsForSelectedGroup());
}

关于java - "Property not found"与 PrimeFaces RemoteCommand,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7064238/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com