是否可以使用如下所示的导航案例具有相同的view-id但与结果不同?在托管bean中,我想比较from-outcome值并决定我将在页面上显示的组面板。如何在托管bean中获取from-outcome值?
<navigation-case>
<from-outcome>modifyphone</from-outcome>
<to-view-id>/modifytelephone.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>confirmmodifyphone</from-outcome>
<to-view-id>/modifytelephone.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>submitmodifyphone</from-outcome>
<to-view-id>/modifytelephone.jsp</to-view-id>
</navigation-case>
答案 0 :(得分:2)
你无法使用结果。只需将其指定为bean属性:
public String submit() {
this.action = MODIFY; // or CONFIRM or SUBMIT
return "modifyphone";
}
(是的,这些是枚举)
然后在JSP页面中:
<h:panelGroup rendered="#{bean.action == 'MODIFY'}"></h:panelGroup>
<h:panelGroup rendered="#{bean.action == 'CONFIRM'}"></h:panelGroup>
<h:panelGroup rendered="#{bean.action == 'SUBMIT'}"></h:panelGroup>