Primefaces中的路径

时间:2014-08-06 23:35:03

标签: netbeans jsf-2 primefaces

www.Mysite.com/account/show_account_info.xhtml
www.Mysite.com/civil/steel/lrfd/column/simple_column.xhtml 
www.Mysite.com/index.xhtml   

您好 当我的当前页面是index.xhtml时,使用此命令按钮我可以转到Page simple_column.xhtml

<p:commandButton value="Simple Column" action="civil/steel/lrfd/column/simple_column"/>

我的问题是:当我的当前页面是simple_column.xhtml并且我想去show_account_info.xhtm我的行动价值是多少?

<p:commandButton value="Show Account Info" action="?" />

请帮帮我。 非常感谢。 Ali Farzadmehr

1 个答案:

答案 0 :(得分:1)

当您完全浏览当前目录时,可以使用

    facesContext.externalContext.applicationContextPath //JSF2.2

    facesContext.externalContext.requestContextPath //JSF2.1

最后,你将拥有(取决于你的JSF版本)

    <p:commandButton value="Show Account Info" action="#{facesContext.externalContext.requestContextPath}/account/show_account_info" />

如果要更好地使用JSF组件,您应该使用<p:button/><h:button/>,如果您需要做的就是导航。它具有更少的开销,并为您的URL的可收藏性提供支持

相关阅读: