开发者

JSF: Using same jsp page for different outcomes

开发者 https://www.devze.com 2022-12-27 18:24 出处:网络
Would it be possible to use a navigation-case as shown below with the same view-id but different from-outcomes? In the managed bean, I wanted to compare the from-outcome values and decide on the group

Would it be possible to use a navigation-case as shown below with the same view-id but different from-outcomes? In the managed bean, I wanted to compare the from-outcome values and decide on the group panel that I would display on the page. How can I get the from-outcome value in my managed bean?

<navigation-case>
    <from-outcome>modifyphone</from-outcome>
    <to-view-id>/modifytelephone.jsp</to-view-id>
</navigation-case>
<navigation-case>
    <from-outcome>confirmmodifyphone</from-outcome>
    <t开发者_StackOverflow中文版o-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>


You can't use outcomes for that. Just assign it as a bean property:

public String submit() {
    this.action = MODIFY; // or CONFIRM or SUBMIT
    return "modifyphone";
}

(yes, those are enums)

and then in JSP page:

<h:panelGroup rendered="#{bean.action == 'MODIFY'}"></h:panelGroup>
<h:panelGroup rendered="#{bean.action == 'CONFIRM'}"></h:panelGroup>
<h:panelGroup rendered="#{bean.action == 'SUBMIT'}"></h:panelGroup>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号