3 Replies Latest reply on Jan 20, 2009 11:25 AM by Ilya Shaikovsky

    Navigation with Panel an Menuitem (Ajax)

    Tim Kaufner Newbie

      Hi!
      I am new to richfaces and I have some problems... How do you navigate in a menu? I need to include another jsp-page on onlick-event when someone clicks a menu-item. It should be done via ajax, so i dont have to reload the entire page. My page (welcome.jsp) looks like that:

      <body>
      <f:view>
       <f:loadBundle basename="messages" var="msg" />
       <rich:panel header="#{msg.label_header}">
       <h:form>
       <rich:toolBar>
       <rich:dropDownMenu>
       <f:facet name="label">
       <h:panelGroup>
       <h:outputText value="#{msg.m_administration}" />
       </h:panelGroup>
       </f:facet>
       <rich:menuItem submitMode="ajax" value="#{msg.mi_editprofile}"></rich:menuItem>
       <rich:menuItem submitMode="ajax" value="#{msg.mi_status}"></rich:menuItem>
       <rich:menuItem submitMode="ajax" value="#{msg.mi_insert}"></rich:menuItem>
       </rich:dropDownMenu>
       </rich:toolBar>
       <a4j:include id="content" viewId="/WEB-INF/pages/empty.jsp"/>
       </h:form>
       </rich:panel>
      </f:view>
      </body>


      As you can see, i did an a4j:include which already works... But I dont know how to replace the "viewId" when someone clicks a menu-button... I am new to richfaces... Can somebody help me? I already know how to navigate on "standard-jsf", but i dont know how to handle this with ajax and richfaces...

      My faces-config looks like this:
      <navigation-rule>
       <from-view-id>/login.jsp</from-view-id>
       <navigation-case>
       <from-action>#{loginBean.validUser}</from-action>
       <from-outcome>success</from-outcome>
       <to-view-id>/WEB-INF/pages/welcome.jsp</to-view-id>
       </navigation-case>
       <navigation-case>
       <from-action>#{loginBean.validUser}</from-action>
       <from-outcome>failure</from-outcome>
       <to-view-id>/login.jsp</to-view-id>
       </navigation-case>
       <navigation-case>
       <from-outcome>forgotpassword</from-outcome>
       <to-view-id>/WEB-INF/pages/forgotpassword.jsp</to-view-id>
       </navigation-case>
      </navigation-rule>


      Thank you very much!