0 Replies Latest reply on Mar 17, 2013 5:35 PM by Alino K

    Create a menu with rich:dropDownMenu and navigation rules

    Alino K Newbie

      Hello

       

      i do a new application based on richfaces 4.3, jsf 2, hibernate on a tomcat server.

       

      i can't do my menu bar properly .when i clicked on a menu, all the page is refresh and the page in the navigation-rules is displayed. My menu and all the next element is not displayed yet.

       

      in french :

      je mets en place une application web basée sur richafaces4.3, jsf 2, hibernate sur un serveur tomcat.

       

      J'essaie de faire un menu. lorsque je clique sur mon menu , toute la page est rafraichit . L'application affihce seulement la page indiqué dans le navigation rules. Le menu et tous les autres éléments ne s'affichent plus.

       

       

       

      fichier index.xhtml

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <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:ui="http://java.sun.com/jsf/facelets"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
      
      
      <ui:composition template="/templates/structure.xhtml">
                          <ui:define name="businessZone">
                                    <ui:include src="/pages/accueil/content.xhtml" />
                          </ui:define>
      </ui:composition>
      
      
      </html>
      

       

       

      fichier structure.xhtml

       

       

      menu.xhtml

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <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:ui="http://java.sun.com/jsf/facelets"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
      
      
      <ui:composition>
      
      
                <h:form id="menuFormId">
                          <rich:toolbar height="26px">
      
      
                                    <rich:dropDownMenu mode="ajax">
                                              <f:facet name="label">
                                                        <h:panelGroup>
                                                                  <h:outputText value="Accueil" />
                                                        </h:panelGroup>
                                              </f:facet>
                                              <rich:menuItem submitMode="ajax"
                                                        action="#{utilisateurCtrl.doLoginUtilisateur}"
                                                        reRender="businessZoneOutpulPanel" limitToList="true">
                                                        <h:outputText value="Accueil" />
                                              </rich:menuItem>
                                    </rich:dropDownMenu>
                          </rich:toolbar>
                </h:form>
      
      
      </ui:composition>
      </html>
      

       

       

      faces-config.xhtml

       

      <?xml version="1.0"?>
      <faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
      
      
              <!-- JSF and Spring are integrated -->
          <application>
              <el-resolver>
                  org.springframework.web.jsf.el.SpringBeanFacesELResolver
              </el-resolver>
          </application>
      
      
                <navigation-rule> 
                          <navigation-case>
                                    <from-action>#{utilisateurCtrl.doLoginUtilisateur}</from-action>
                                    <from-outcome>success</from-outcome>
                                    <to-view-id>/pages/accueil/test.xhtml</to-view-id>
                          </navigation-case>
        
                </navigation-rule>
        
      </faces-config>
      

       

       

      test.xhtml

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <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:ui="http://java.sun.com/jsf/facelets"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
      
      
      <!-- <ui:composition template="/templates/structure.xhtml"> -->
      <ui:composition>
      
      
                <!--           <a4j:outputPanel id="businessZoneOutpulPanel"> -->
                <!--                     <rich:panel styleClass="main_content"> -->
                <rich:panel styleClass="container">
                                              ça fonctionne si tu vois le menu 
      
      
                </rich:panel>
      </ui:composition>
      </html>
      

       

       

       

      Merci de votre aide