6 Replies Latest reply on Oct 11, 2007 8:53 AM by carlhowarth

    DropDownMenu How to redirect to another page

    haoues01

      Hi,

      I'm newbie and I would like to know how to use the <rich:DropDownMenu>
      to navigate through my application (e.g classic javascript menu);

      <rich:dropDownMenu id="MenuItem1" value="Item1" >
      <rich:menuGroup id="menuGroup1" value="Group1">
      <rich:menuItem id="menuGroup1Item1" value="Active"
      action="http://www.google.com"/> etc ...

      Thanks in advance.

        • 1. Re: DropDownMenu How to redirect to another page

          action="http://www.google.com" is incorrect statement in JSF. action is NOT a URL, but reference to the action method returns String (or just String outcome in the simple case) that is used than in the navigation rule defined the faces-config.xml

          However, if you DO NOT want to navigate through your application (like you originally asked), but want to navigate to outside the application (using external URL), you can use approach shown in the http://livedemo.exadel.com/richfaces-demo/richfaces/dropDownMenu.jsf , See "Links" menu item there.

          • 2. Re: DropDownMenu How to redirect to another page
            haoues01

            Hi SergeySmirnov,

            Thanks a lot for you reply. You'll find below my faces-config.xml and my DropDownMenu. Could you please tell me what's wrong whith this ?


            faces-config.xml :

            ...
            <navigation-rule>
            <from-view-id>/accounts.jsp</from-view-id>
            <navigation-case>
            <from-outcome>acctedit</from-outcome>
            <to-view-id>/account-edit.jsp</to-view-id>
            </navigation-case>
            </navigation-rule>

            <navigation-rule>
            <from-view-id>/login.jsp</from-view-id>
            <navigation-case>
            <from-outcome>login</from-outcome>
            <to-view-id>/main.jsp</to-view-id>
            </navigation-case>
            </navigation-rule>

            <navigation-rule>
            <from-view-id>/members.jsp</from-view-id>
            <navigation-case>
            <from-outcome>memberedit</from-outcome>
            <to-view-id>/member-edit.jsp</to-view-id>
            </navigation-case>
            </navigation-rule>
            ...

            Menu :

            <c:if test="${user.loggedIn}">
            <f:view>
            <h:form>
            <rich:toolBar width="500px" itemSeparator="line">
            <rich:dropDownMenu value="Accounts Receivable" >
            <rich:menuItem value="Main AR" action="memberedit"/>
            <rich:menuItem value="Preview Invoices" action="acctedit"/>
            </rich:dropDownMenu>
            </rich:toolBar>
            </h:form>
            </f:view>

            </c:if>

            Thanks in advance.

            • 3. Re: DropDownMenu How to redirect to another page
              haoues01

              Sorry ...

              I tried to find out the source code of the demo http://livedemo.exadel.com/richfaces-demo/richfaces/dropDownMenu.jsf but I haven't found it so far.

              • 4. DropDownMenu How to redirect to another page

                Hello there,

                I think there may be a bug in this, unless of course I'm doing something incorrectly (always possible!). I have a global navigation rule setup and have tried the following two ways of getting this rule to be called from the drop down menu item:

                Number 1:

                <rich:dropDownMenu value="Test">
                 <rich:menuItem value="Test1" action="testnavrule1"/>
                </rich:dropDownMenu>
                


                Number 2:
                <rich:dropDownMenu value="Test">
                 <rich:menuItem>
                 <h:commandLink action="testnavrule1" value="Test1" />
                 </rich:menuItem>
                </rich:dropDownMenu>
                


                Both of which don't work! If I put the command link outside of the menu item the navigation rule is adhered to.

                Can anybody help at all?

                I am using:

                Tomcat 6.0.14
                MyFaces 1.2.0
                Tomahawk 1.1.6
                Richfaces 3.1.1-GA

                Ta very much, Carl


                • 5. Re: DropDownMenu How to redirect to another page
                  dmitry.demyankov

                  The first one worked fine for me..

                  • 6. Re: DropDownMenu How to redirect to another page

                    Yes, I've cracked it now - it was entirely my fault - a new app mixing up 'from-outcome' with 'from-action' in my faces-config.

                    Sorry for wasting your time!