我在 faces-config.xml 中有一个带有导航规则的 JSF 按钮:
<h:commandButton id="newzone" styleClass="lbimage" value="New Zone" action="#{bean.navigateToNewZone()}">
<f:ajax render="@form"></f:ajax>
</h:commandButton>
// Navigate to New Zone page
public int navigateToNewZone(){
return 11472;
}
<navigation-rule>
<description>Navigation rule to New Zone page</description>
<from-view-id>/ZonesList.xhtml</from-view-id>
<navigation-case>
<from-action>#{ZonesController.navigateToNewZone()}</from-action>
<from-outcome>11472</from-outcome>
<to-view-id>/NewZone.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
我的问题是如何简化导航?我不想将导航规则添加到 faces-config.xml 中。有没有办法从 JSF 按钮直接打开新页面?