我有一个jsf页面index.xhtml
<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
>
<h:head>
<title>Index Page</title>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="100" resizable="false" closable="false" collapsible="false">
<h:form>
<ui:include src="../header.xhtml" />
</h:form>
</p:layoutUnit>
<p:layoutUnit position="west" size="200" resizable="false" closable="false" collapsible="false">
<h:form>
<ui:include src="../leftpanel.xhtml" />
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
<ui:insert name="content">Blank</ui:insert>
</p:layoutUnit>
</p:layout>
</h:body>
</html>
上页的布局有点像这样
-------------------------------------------------------
| |
| <header> |
|______________________________________________________|
| | |
| | |
| <left> | <center> |
| | |
| | |
|_______________|______________________________________|
我正在使用Primefaces 3.x和JSF 2.x.我有一个要求,左侧布局上有链接,如菜单及其子菜单,单击子菜单项,页面应在中心布局中打开。有人可以指导我,怎么做?
答案 0 :(得分:-1)
您必须在xhtml页面中定义内容
...
<h:body>
<ui:composition template="index.xhtml">
<ui:define name="content">
</ui:composition>
</h:body>
...
菜单/子菜单中的链接必须返回faces-config中定义的结果,例如:
<navigation-rule>
<from-view-id>/*</from-view-id>
<navigation-case>
<from-outcome>subemnu1</from-outcome>
<to-view-id>/submenu1.xhtml</to-view-id>
</navigation-case>
</navigation-rule>