你有二種方案可以選用 - 以舊有的方式在 faces-config.xml 中配置規則
- 使用 JSF 2 帶來的新特性 (Java EE 6+)
可視化編程(NetBeans - PageFlow)
Redirect <navigation-rule>
<from-view-id> /customer/* </from-view-id>
<navigation-case>
<from-outcome>customer_create</from-outcome>
<to-view-id>/customer/New.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>customer_list</from-outcome>
<to-view-id>/customer/List.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>customer_edit</from-outcome>
<to-view-id>/customer/Edit.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>customer_detail</from-outcome>
<to-view-id>/customer/Detail.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule> Action<navigation-rule> <from-view-id>/pages/inputname.jsp</from-view-id>
<navigation-case> <from-outcome>sayHello</from-outcome> <to-view-id>/pages/anotherhello.jsp</to-view-id> </navigation-case> <navigation-case> <from-action>#{GetNameBean.helloAction}</from-action> <from-outcome>sayHello</from-outcome> <to-view-id>/pages/hello.jsp</to-view-id> </navigation-case>
</navigation-rule>
Reference |