您可以通过ajax重新加载内容,但URL将保持不变。如果负担得起,请按如下所示更新代码:
在中
template.xhtml,替换
<div id="content">
通过
<h:panelGroup id="content" layout="block">
然后在中
somepage.xhtml,替换
<p:commandButton value="Create entry" action="create" />
通过
<p:commandButton value="Create entry" action="create" update=":content" />
最终摆脱
<redirect/>(实际上,更希望摆脱所有导航案例,因为它们会使
faces-config.xml文件the 肿)。重定向也可以在结果中指定,如中所示
action="create?faces-redirect=true"。
这只会更新
<title>。但是,您可以使用简单的Javascript行来实现。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)