javax.faces.component.UpdateModelException:javax.el.PropertyNotFoundException:

时间:2013-01-09 19:08:01

标签: java jsf-2 propertynotfoundexception icefaces-2

我正在开发一个JSF2,Icefaces Web应用程序。我有以下观点:

<h:dataTable value="#{myFormBB.userRolesBean.userRoleList}" var="row">
    <h:column>
        <ice:selectBooleanCheckbox value="#{row.teamUser}" />

当我保存上述<ice:selectBooleanCheckbox>时,我得到以下异常。

Application caught instance of: javax.faces.component.UpdateModelException
["http-bio-8081"-exec-9] ERROR com.abc.mp.em.common.ui.exception.handler.ExceptionHandler - error
javax.faces.component.UpdateModelException: javax.el.PropertyNotFoundException: /sections/response/myForm.xhtml @599,78 value="#{row.teamUser}": Property 'teamUser' not writable on type boolean
    at javax.faces.component.UIInput.updateModel(UIInput.java:849)
    at javax.faces.component.UIInput.processUpdates(UIInput.java:731)
    at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
    at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
    at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
    at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)

我已经在支持bean中正确定义了属性及其getter和设置。

protected boolean teamUser;

public boolean isTeamUser() {
    return teamUser;
}

public void setTeamUser(boolean teamUser) {
    this.teamUser = teamUser;
}

这是如何引起的,我该如何解决?我需要使用转换器吗?

1 个答案:

答案 0 :(得分:2)

  

value =“#{row.teamUser}”:属性'teamUser'在类型boolean上不可写

此错误基本上告诉我#{row}boolean(或Boolean),而teamUser确实没有#{myFormBB.userRolesBean.userRoleList}属性。

这反过来表明List<Boolean>实际上返回了List<SomeBeanWithTeamUserProperty>而不是{{1}}。验证并修复您的模型。

相关问题