我正在使用帶有``的primefaces 3.1,有四個位置。 在西部位置(西部),我添加了樹形菜單。 JSF代碼如下帶有樹形菜單的Primefaces頁面佈局導航
<p:layoutUnit position="west" size="200" header="Left"
resizable="true" collapsible="true">
<h:form>
<p:tree dynamic="true" value="#{treeBean.root}" var="node" id="tree"
selectionMode="single">
<p:treeNode id="treeNode">
<h:outputText value="#{node}" id="lblNode" />
</p:treeNode>
</p:tree>
</h:form>
</p:layoutUnit>
,並在TreeBean我
root = new DefaultTreeNode("Root", null);
TreeNode node0 = new DefaultTreeNode("Color", root);
TreeNode node00 = new DefaultTreeNode("Red", node0);
TreeNode node01 = new DefaultTreeNode("Blue", node0);
TreeNode node02 = new DefaultTreeNode("Green", node0);
是它有可能的導航,當我展開,並單擊其中的一個節點,並在點擊相應的節點我怎麼能顯示JSF頁面在佈局的中心位置。即如果我點擊了節點Blue,理想情況下我想將另一個jsf頁面加載到佈局的中心位置。
任何幫助是非常可觀的。
感謝
更新1
我加入以下代碼,它並導航到start.xhtml。但是,start.xhtml不顯示在我的佈局中,start.xhtml顯示爲新頁面。
public void onNodeSelect(NodeSelectEvent event) {
try {
System.out.println(" here " + event.getTreeNode().getData());
FacesContext
.getCurrentInstance()
.getApplication()
.getNavigationHandler()
.handleNavigation(FacesContext.getCurrentInstance(),
"null", "/start.xhtml?faces-redirect=true");
} catch (Exception e) {
logger.info("error "+e.getMessage());
// TODO: handle exception
}
是否有任何其他方式來實現這一目標? – user75ponic
感謝您的幫助,我會嘗試一下。 – user75ponic