禁用值在bean中为p:selectOneMenu获取null

时间:2013-12-12 07:00:32

标签: jsf primefaces

我想基于employeeno禁用部门字段。但是,我想在bean中使用部门值。当我使用禁用值在bean中获取null而不使用禁用没有问题...

<h:outputText value="Employee No"/>
  <p:selectOneMenu value="#{salarypromotionBean.salarypromotiondto.employeeNo}" id="emp" style="width:163px;">
  <f:selectItem itemLabel="select" itemValue="0" />
  <f:selectItems value="#{salarypromotionBean.empid}"/>
  <p:ajax event="change" listener="#{salarypromotionBean.currentSalaryAmount}" update="salaryIncrement,empN,empDoj,basic,da,empNewDesig,commonSalaryIncrement"/>
  </p:selectOneMenu>

 <h:outputText value="Department" />
    <p:selectOneMenu value="#{salarypromotionBean.salarypromotiondto.department}" id="empDept"  disabled="#{salarypromotionBean.designationDiaspleValue}" 
     style="width:163px;">
   <f:selectItems value="#{salarypromotionBean.deptname}" />
   </p:selectOneMenu>

1 个答案:

答案 0 :(得分:1)

你可以这样做。

<p:selectOneMenu value="#{salarypromotionBean.salarypromotiondto.department}" id="empDept"  rendered="#{!salarypromotionBean.designationDiaspleValue}" 
     style="width:163px;">
   <f:selectItems value="#{salarypromotionBean.deptname}" />
 </p:selectOneMenu>

<p:inputText value="#{salarypromotionBean.salarypromotiondto.department}" readonly="true" rendered="#{salarypromotionBean.designationDiaspleValue}"/>