简体   繁体   English

SelectBooleanCheckbox中的PropertyNotFoundException

[英]PropertyNotFoundException in SelectBooleanCheckbox

I have one checkbox per each node in TreeNode component of PrimeFaces 3.3.1 which is throwing a javax.el.PropertyNotFoundException inside its value attribute. 我在PrimeFaces 3.3.1的TreeNode组件中的每个节点上都有一个复选框,该复选框在其value属性内抛出javax.el.PropertyNotFoundException Here's my code: 这是我的代码:

<p:tree value="#{CadBean.treeNode}" var="rec">  
<p:treeNode>
    <h:outputText value="#{rec.codigo}" />
</p:treeNode>

<p:treeNode type="Funcionality" icon="ui-icon16-weblibrary-folderopened">
    <p:selectBooleanCheckbox value="#{CadBean.alreadyAssociated(rec.id)}">
        <p:ajax event="click" listener="#{CadBean.onrecClicked(rec.id)}" />
    </p:selectBooleanCheckbox>
    <h:outputText value="#{rec.codigo}" />
</p:treeNode>

<p:treeNode type="Page" icon="ui-icon16-weblibrary-htmlpage">
    <p:selectBooleanCheckbox value="#{CadBean.alreadyAssociated(rec.id)}">
        <p:ajax event="click" listener="#{CadBean.onrecClicked(rec.id)}" />
    </p:selectBooleanCheckbox>
    <h:outputText value="#{rec.codigo}" />
</p:treeNode>

<p:treeNode type="System" icon="ui-icon16-weblibrary-computer">
    <h:outputText value="#{rec}" />
</p:treeNode>

The exception is thrown in value="#{CadBean.alreadyAssociated(rec.id)}" . value="#{CadBean.alreadyAssociated(rec.id)}"引发异常。

The boolean method is like this: 布尔方法是这样的:

public boolean alreadyAssociated(int recId) {
for (Association a : associations) {
    if (a.getRec().getId() == recId) {
        return true;
    }
}
return false;
}

And here's the exception: 这是一个例外:

SEVERE: javax.el.PropertyNotFoundException: /s_ca/cadRec.xhtml @54,122 value="#{CadBean.alreadyAssociated(rec.id)}": Property 'alreadyAssociated' not found on type br.com.tsg.web.beans.CadBean

I'm using Mojarra 2.1.9 and can't use selectionMode="checkbox" in the TreeNode because I'll need two more components with the checkbox. 我正在使用Mojarra 2.1.9,并且无法在TreeNode中使用selectionMode="checkbox" ,因为该复选框需要另外两个组件。

Thanks. 谢谢。

Solved. 解决了。 I just had to create a method like this: 我只需要创建一个这样的方法:

public void setAlreadyAssociated(boolean b) {
}

Yeah, it's a bad workaround... but solved. 是的,这是一个不好的解决方法...但已解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM