在详细画面中,通过隐藏状态的值来控制删除按钮是否显示,当状态为”更新”时则显示删除按钮,否则不显示.
问题:当没有输入企業CD时,JSF将不执行update model values等阶段,这时value="#{REQPG010EAction.status}"
的值为null.... <c:if....>失效了,各位,jsf怎样处理类似问题?
<c:if test="${REQPG010EAction.status == 'update'}">
<h:commandButton value="删除" onclick="getCtrl();" action="#{REQPG010EAction.do_delete_logic}" />
</c:if> <h:inputHidden id="status" value="#{REQPG010EAction.status}" />
<h:inputText id="trd_id" label="企業CD" size="40"
style="height: 15px;" required="true" value="#{REQPG010EAction.trd_id}">
<gr:validateByteLength maxLength="8" />
</h:inputText>
<managed-bean-name>customer</managed-bean-name>
<managed-bean-class>foo.Customer</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>status</property-name>
<property-class>java.lang.String</property-class>
<value>update</value>
</managed-property>
</managed-bean>
String status="";
<h:commandButton value="删除" onclick="getCtrl();" action="#{REQPG010EAction.do_delete_logic}"
rendered="#{!empty REQPG010EAction.status && REQPG010EAction.status==\"update\"}"
/> <h:inputHidden id="status" value="#{REQPG010EAction.status}" />
<h:inputText id="trd_id" label="企業CD" size="40"
style="height: 15px;" required="true" value="#{REQPG010EAction.trd_id}">
<gr:validateByteLength maxLength="8" />
</h:inputText>看来你没有领会到rendered的用途