实际上,该示例在 Chrome 上运行,至少在 OSX 上运行。我会发布我的版本 - 也许在黑暗中潜伏着细微的差别:
索引.xhtml:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>BootsFaces: next-gen JSF Framework</title>
<meta name="author" content="Riccardo Massera"></meta>
</h:head>
<h:body style="padding-top: 60px">
<div class="ui-grid ui-grid-responsive">
<div class="ui-grid-row">
<div class="ui-grid-col-5" id="menuLeft">
<ui:include src="menu.xhtml" />
</div>
<div class="ui-grid-col-5" id="ber">
<p:panel id="principalePanel" title="principale" >
<ui:include src="#{navigationBean.page}" />
</p:panel>
</div>
</div>
</div>
</h:body>
</html>
菜单.xhtml:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui "
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<b:panel id="basic" title="Modules" collapsible="false" look="primary">
<h:form id="formMenuLeft">
<p:accordionPanel id="panelMenuLeft">
<p:tab title="R H" id="tabMenuLeft">
<b:flyOutMenu id="ferd">
<b:navLink value="New Compte" id="navcreat" update="@([id=principalePanel])"
onclick="ajax:navigationBean.setPage('start.xhtml')" />
<b:navLink value="search" id="fedrt" update=":#{p:component('principalePanel')}"
onclick="ajax:navigationBean.setPage('search.xhtml')" />
</b:flyOutMenu>
</p:tab>
</p:accordionPanel>
</h:form>
</b:panel>
</ui:fragment>
搜索.xhtml:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui "
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<b:panel title="Search" look="success">
</b:panel>
</ui:fragment>
开始.xhtml:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui "
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<b:panel title="Create" look="primary">
</b:panel>
</ui:fragment>
NavigationBean.java:
package net.bootsfaces.demo.ajax;
import java.io.IOException;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
@ManagedBean
@SessionScoped
public class NavigationBean implements Serializable {
private static final long serialVersionUID = 1L;
private String page="start.xhtml";
public String getPage() {
return page;
}
public void setPage(String currentPage) {
this.page=currentPage;
}
}