JSF页面逻辑处理出错
我有个用户编辑页面,editUser.xhtml,
因为编辑用户和新增用户共用这个页面,所以用户ID需要在编辑状态设置成只读.
<h:inputText styleClass="midInput" disabled="true" value="#{userBean.user.userId}" rendered="#{userBean.type == 'update'}" id="userId" required="true" requiredMessage="用户ID不能为空" maxlength="8">
<f:validateLength minimum="1" maximum="8" />
</h:inputText>
<h:inputText styleClass="midInput" value="#{userBean.user.userId}" rendered="#{userBean.type == 'add'}" id="userId" required="true" requiredMessage="用户ID不能为空" maxlength="8">
<f:validateLength minimum="1" maximum="8" />
得到异常:
java.lang.IllegalStateException: component with duplicate id "editForm:userId" found
Caused by:
java.lang.IllegalStateException - component with duplicate id "editForm:userId" found
说userId重复 ,这种情况如何处理呢?