Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Primefaces页面布局,以树菜单作为导航_Java_Jsf 2_Primefaces - Fatal编程技术网

Java Primefaces页面布局,以树菜单作为导航

Java Primefaces页面布局,以树菜单作为导航,java,jsf-2,primefaces,Java,Jsf 2,Primefaces,我使用的primefaces 3.1带有`,有四个位置。 在西侧位置(西侧),我添加了树菜单。JSF代码如下 <p:layoutUnit position="west" size="200" header="Left" resizable="true" collapsible="true"> <h:form> <p:tree dynamic="true" value="#{treeBea

我使用的primefaces 3.1带有`,有四个位置。 在西侧位置(西侧),我添加了树菜单。JSF代码如下

<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>
当我展开并单击其中一个节点时,是否可以进行导航?单击相应的节点时,如何在布局的中心位置显示jsf页面。i、 如果我单击node 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
        } 

这是在布局的帮助下实现的。为应用程序定义布局模板。样本显示在这里

myLayoutTemplate.xhtml

       <p:layout>
        <p:layoutUnit position="east" header="Menu"  collapsed="true" scrollable="true" collapsible="true" >
            <ui:insert name="appMenu">
                Place Your menu here ...
            </ui:insert>
        </p:layoutUnit>

        <p:layoutUnit position="center" scrollable="true">
            <ui:insert name="pageContent">
                Page Content is loaded here .....
            </ui:insert>
        </p:layoutUnit>
    </p:layout>

把菜单放在这里。。。
页面内容在此处加载。。。。。
在单击菜单项时加载的Page.xhtml中,…

<ui:composition template="myLayoutTemplate.xhtml">
    <ui:define name="pageContent">

    </ui:define>
</ui:composition>

我认为这篇文章对你非常有用


它描述了如何创建模板,然后在
模板客户端中使用它@rags已经告诉过你了,但你真的不必使用
。上面链接的文章更准确。我相信你会在那里找到你需要的东西。问候

还有其他方法吗?谢谢你的帮助,我会尝试一下。
<ui:composition template="myLayoutTemplate.xhtml">
    <ui:define name="pageContent">

    </ui:define>
</ui:composition>