“未找到财产”使用 PrimeFaces 远程命令

发布于 2024-11-29 14:42:15 字数 2661 浏览 1 评论 0 原文

我正在尝试使用 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.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) 。

非常感谢任何帮助,谢谢

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不再让梦枯萎 2024-12-06 14:42:15

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

我在问题中发布的操作侦听器下定义了一个注释掉的操作侦听器:

<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());
}

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());
}
日久见人心 2024-12-06 14:42:15

actionListener="#{permissionsToGroupsBean.updatePermissions}"不熟悉当前版本的 PrimeFaces,但通常actionListener属性应该返回一个对象,该对象实现ActionListener接口。因此,您的表达式将被解析为不存在的 getUpdatePermissions()`,因此您会收到该消息。

如果您添加了该方法,您应该会看到另一个问题,即返回值不是 ActionListener

标记是否支持 action 属性?

actionListener="#{permissionsToGroupsBean.updatePermissions}" Im not familiar with the current version of PrimeFaces but generally theactionListenerproperty would be expected to return an object that implements theActionListenerinterface. Thus your expression would be resolved togetUpdatePermissions()` 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?

盛夏尉蓝 2024-12-06 14:42:15

updatePermissions(ActionEvent e) ?

updatePermissions(ActionEvent e) ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文