为什么<p:panel>的更新在IE中有效但在chrome中无效

时间:2016-05-02 16:00:46

标签: primefaces jsf-2.2 bootsfaces

我想在其他地方加入&#34; .xhtml&#34; ;它在&#34; Internet Explorer &#34;中完美运行但不是&#34; Chrome &#34;

我的原则视图 ,其中包含两个视图,其中一个是menu.xhtml:

<ui:define name="content">
    <div class="ui-grid ui-grid-responsive">
        <div class="ui-grid-row">

            <div class="ui-grid-col-1" id="menuLeft">
                 <ui:include src="menu.xhtml" /> 

            </div>

            <div class="ui-grid-col-1" id="ber">
                <p:panel id="principalePanel" >
                    <ui:include src="#{navigationBean.page}" />
                </p:panel>
            </div>

        </div>
    </div>

</ui:define>

名为menu.xhtml: ;我应该使用<b:navLink>

在我的 我的原则视图 中包含其他视图
<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('viewcreat.xhtml')"/>

                        <b:navLink value="search" id="fedrt" update=":#{p:component('principalePanel')}"onclick="ajax:navigationBean.setPage('viewSearch.xhtml')"/>

                    </b:flyOutMenu>

                </p:tab>

            </p:accordionPanel>

            </h:form>
            </b:panel>

1 个答案:

答案 0 :(得分:0)

实际上,该示例适用于Chrome,至少在OSX上有效。我会发布我的版本 - 也许在黑暗中潜伏着微妙的差异:

<强>的index.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>

<强>名为menu.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>

<强> search.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>

<强> start.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;
        }
     }