3 Replies Latest reply on Jul 30, 2007 1:00 PM by John Doe

    Changing/Updating an area by a menu item

    John Doe Newbie

      Hi All,

      I am trying to make my first RichFaces/JSF application. It looks like a desktop application with menu, toolbar, body and footer.

      I am trying to update the body content when a menu option or tool bar button are fired. But I am not achieving that.

      So I have the menu item in a default-menu.jsp:

      ...
      <rich:menuItem submitMode="ajax"
       onclick="Richfaces.showModalPanel('mp',{width:450, top:200})"
       value="#{msg.lbl_menu_analysis_call}"
       action="loadOperationLogin" reRender="centerGrid">
      
       <f:facet name="icon">
       <h:graphicImage value="/images/webapp_welcome.gif" />
       </f:facet>
      </rich:menuItem>
      ...
      


      The action called above is declared as follows:

      ...
      <navigation-rule> <from-view-id>/WEB-INF/pages/layout/default-menu.jsp</from-view-id>
       <navigation-case>
       <from-outcome>loadOperationLogin</from-outcome>
       <to-view-id>
       /WEB-INF/pages/operation/operationLogin.jsp
       </to-view-id>
       </navigation-case>
      </navigation-rule>
      ...
      


      And the page layout comes as (where I have my "centerGrid" to be updated/changed):

      <f:view>
       <h:panelGrid columns="1" style="width:800px;height:600px;" border="1">
      
       <h:panelGrid id="headerGrid" columns="1" style="width:100%;valign:top;"
       border="1">
       <jsp:include page="/WEB-INF/pages/layout/default-menu.jsp" />
       <rich:separator lineType="beveled" height="5" width="100%" />
       <jsp:include page="/WEB-INF/pages/layout/default-toolbar.jsp" />
       </h:panelGrid>
      
       <h:panelGrid id="centerGrid" columns="1" border="1"
       style="width:100%;height:100%;valign:top;">
      
       <a:include viewId="/WEB-INF/pages/layout/default-center.jsp" />
       </h:panelGrid>
      
       </h:panelGrid>
      
       <jsp:include page="/WEB-INF/pages/layout/default-messages.jsp" />
      
      </f:view>
      


      When I run the application operationLogin.jsp is showed in place of default-menu.jsp area instead of "centerGrid" and finally disappears again. So all becames the same again. Can someone shed some light here because I don´t know what trick I am missing.

      I supose that this kind of application is a "little" more audacious than a simple hello word application for a beginner, but I am so motivated to learn RichFaces that I dare the challenge.

      Best Regards,
      Iktuz.

        • 1. Re: Changing/Updating an area by a menu item
          John Doe Newbie

          Sorry, the behavior described before happens when I am using <a:inlude> tag:

          <f:view>
          
           <h:panelGrid columns="1" style="width:800px;height:600px;" border="1">
          
           <h:panelGrid id="headerGrid" columns="1" style="width:100%;valign:top;"
           border="1">
           <a:include viewId="/WEB-INF/pages/layout/default-menu.jsp" />
           <rich:separator lineType="beveled" height="5" width="100%" />
           <a:include viewId="/WEB-INF/pages/layout/default-toolbar.jsp" />
           </h:panelGrid>
          
           <h:panelGrid id="centerGrid" columns="1" border="1"
           style="width:100%;height:100%;valign:top;">
          
           <a:include viewId="/WEB-INF/pages/layout/default-center.jsp" />
           </h:panelGrid>
          
           </h:panelGrid>
          
           <a:include viewId="/WEB-INF/pages/layout/default-messages.jsp" />
          
          </f:view>
          


          With <jsp:include> the menu does not disappear, but center grid just resets its default state.

          Best Regards,
          Iktuz

          • 2. Re: Changing/Updating an area by a menu item
            Ilya Shaikovsky Master

            you can't use ajax navigation for a:include from ajax controls outside this a:include.

            Your way is to bing viewId to some bean property, change the property to the one you need in your bean and then reRednder include area.

            • 3. Re: Changing/Updating an area by a menu item
              John Doe Newbie

              Thanks for answering Ilya,

              It works fine now. So my layout now is:

              <f:view>
              
               <h:panelGrid columns="1" style="width:800px;height:600px;" border="1">
              
               <h:panelGrid id="headerGrid" columns="1"
               style="width:100%;valign:top;" border="1">
               <a:include viewId="/WEB-INF/pages/layout/default-menu.jsp" />
               <rich:separator lineType="beveled" height="5" width="100%" />
               <a:include viewId="/WEB-INF/pages/layout/default-toolbar.jsp" />
               </h:panelGrid>
              
               <a:outputPanel id="teste" ajaxRendered="true">
               <h:panelGrid id="centerGrid" columns="1" border="1"
               style="width:100%;height:100%;valign:top;">
              
               <a:include viewId="#{menuBean.address}" />
               </h:panelGrid>
               </a:outputPanel>
              
               </h:panelGrid>
              
               <a:status id="damnStatus"
               onstart="Richfaces.showModalPanel('mp',{width:450, top:200})"
               onstop=""></a:status>
              
               <a:include viewId="/WEB-INF/pages/layout/default-messages.jsp" />
              
              </f:view>
              


              Now my managed bean (menuBean) controls the address. However, is there a way to not lose navigation rules? How can I access it? Because I could indicate by parameters what I need inside the page:

              <rich:menuItem submitMode="ajax"
               value="#{msg.lbl_menu_analysis_call}"
               actionListener="#{menuBean.load}" reRender="teste">
               <a:actionparam name="what" value="operationLogin"></a:actionparam>
               <f:facet name="icon">
               <h:graphicImage value="/images/webapp_welcome.gif" />
               </f:facet>
               </rich:menuItem>
              


              Thanks a lot,
              Iktuz.