2012-09-12 65 views
0

我有一個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

檢查這個.. ..http://stackoverflow.com/questions/10444584/primefaces-page-layout-with-tree-menu-as-navigation/10445869#10445869 – rags

回答

-1

您的XHTML頁面定義與內容

... 
<h:body> 
    <ui:composition template="index.xhtml"> 
     <ui:define name="content"> 
    </ui:composition> 
</h:body> 
... 

而且在菜單/子菜單鏈接必須返回在臉上,配置界定的成果,例如:

<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> 
相關問題