2 Replies Latest reply on Feb 14, 2011 12:47 PM by Satya K

    How to navigate to a page after bean is called

    Satya K Newbie

      Hi All,

       

      I have a rich:toolBar inwhich when I click on a menuItem, it is supposed to initialize few parameters in my backing bean and then navigate to the respective view page.

       

      Could you let me know how this could be done?

       

      i.e as per code after addNew method is called, the view should be as per navigation rule.

       

      rich:toolBar code is :

       

              <rich:toolBar id="menuBar">

                  <rich:dropDownMenu>

                      <f:facet name="label">Menu</f:facet>

                      <rich:menuItem value="#{msg.menuAddMember}" submitMode="ajax"

                          action="#{memberBean.addNew}">

                      </rich:menuItem>

                  </rich:dropDownMenu>

              </rich:toolBar>

       

      and

       

      navigation rule is :

       

          <navigation-rule>

              <from-view-id>/common/template.xhtml</from-view-id>

              <navigation-case>

                  <from-action>#{memberBean.addNew}</from-action>

                  <to-view-id>/pages/addMember.xhtml</to-view-id>

              </navigation-case>

          </navigation-rule>

       

      Regards,

      Satya

        • 1. How to navigate to a page after bean is called
          Satya K Newbie

          Otherwise I would like to put it this way :

           

          When I click on the menuItem, I would like to initialise some List for dropdown values from DB before navigating to view where I make use of the the List for dropDown display.

           

          How this could be done?

           

          Regards,

          Satya

          • 2. How to navigate to a page after bean is called
            Satya K Newbie

            That seems to be pretty simple after I figured out how to do that.

             

            I added action aswell as actionListener for the rich:menuItem and it worked as I wanted it  to.

             

            <rich:menuItem value="#{msgs.menuAddMember}" action="addMemberAction" actionListener="#{memberBean.addNew}"/>

             

            With above code, 1st listener is invoked which will populate dropdown values and then move to view which makes use of those dropdowns.

             

            Regards,

            Satya