1
我已经使用facelets模板完成了一个基本的JSF应用程序。我的模板如下:导航时部分页面更新(PrimeFaces ajax)
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<!-- Links to CSS stylesheets... -->
<title><ui:insert name="title" /> - FManager</title>
</h:head>
<h:body>
<div id="wrapper">
<div id="header"> <b>FManager</b> Application </div>
<div id="content">
<p:growl id="growl" />
<ui:insert name="content">
Sample content.
</ui:insert>
</div>
</div>
<div id="footer">Made using JSF and Primefaces</div>
</h:body>
</html>
然后,我有一个主页(如下图所示),导航到一个第二页。这两个页面都使用上面的模板。
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
template="./template.xhtml">
<ui:define name="title">Main page</ui:define>
<ui:define name="content">
<h2>Welcome to the <b>FManager</b> application</h2>
<h:form>
<p>Click the button below to create the first entry!</p>
<p:commandButton value="Create entry" action="create" />
</h:form>
</ui:define>
</ui:composition>
如果我faces-config.xml中,将定位用<redirect/>
,但全页面重新加载。我的问题是:
有没有办法从一个页面导航到另一个只更新模板的<ui:insert>
部分?(同时保持页面的其余部分不变)
谢谢!