2 Replies Latest reply: Dec 20, 2011 5:11 PM by Sharath Nagendra RSS

Syntax for linking to got to a different page

Sharath Nagendra Newbie

I am trying to figure out the syntax in a jsf/richfaces portlet using jboss portletbridge to have a link to take the user to the next page after setting some values as part of an action or a listener.

 

The example in JBoss documentation is for a h:outputlink (Linking to Portlet/JSF Pages Using h:outputink) to go to a different page which works for me, but I have a case where I have a table with each row having a link to got to the next page and this would need some values set on the managed bean so that the next page can use this information.

 

I have done this numerous times in a web app using commandlink, but when I try a command link it does not work for this purpose in a portlet. Here is what I have tried with commandlink:

 

 

 

< h:commandLink action="#{bean.viewDetails}"  value ="View details.">

    

<f:param name="javax.portlet.faces.ViewLink" value="true" />

 

</h:commandLink>

 

 

 

 

 

 

the action method returns the location of the next page, but the link is not taking me to the next page like the outputlink does.

 

What would be the way to get this functionality working? any option to set values as part of outputlink or parameters for command link so that the link takes me to the next page or other options?

  • 1. Re: Syntax for linking to got to a different page
    Ken Finnigan Master

    Your command link probably just needs to be something like:

     

    <h:commandLink id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
    

     

    And then in pages.xml (for Seam 2), or the equivalent for pure JSF, you can specify that the navigation from that action redirects to a different page.  Such as:

     

    <page view-id="/main.xhtml">
         <navigation from-action="#{hotelBooking.selectHotel(hot)}">
              <render view-id="/hotel.xhtml"/>
         </navigation>
    </page>
    

     

    Hope that helps

  • 2. Re: Syntax for linking to got to a different page
    Sharath Nagendra Newbie

    Ken, thanks for the response.

    In a pure web app, just the action method returning the right URL works, but not in a portlet.

    It worked, my mistake was I had not configured the page navigation in faces-config, after doing that it worked.