Partial page update when navigating (PrimeFaces ajax)

隐身守侯 提交于 2019-11-30 16:36:44

You can reload content by ajax, but URL will stay the same. If you can afford that, update the code as follows:

In template.xhtml, replace

<div id="content">

by

<h:panelGroup id="content" layout="block">

And in somepage.xhtml, replace

<p:commandButton value="Create entry" action="create" />

by

<p:commandButton value="Create entry" action="create" update=":content" />

Finally get rid of the <redirect /> (actually, prefer to get rid of all navigation cases since they make the faces-config.xml file bloated). A redirect can by the way also be specified in the outcome as in action="create?faces-redirect=true".

This does only not update the <title>. You could however do that with a simple JavaScript line.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!