pretty:link and query parameter

Splash Forums PrettyFaces Users pretty:link and query parameter

This topic contains 9 replies, has 4 voices, and was last updated by  Sebastian Sachtleben 10 years, 8 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #17857


    How can I render a link like this using pretty:link

    e.g.: /pages/personal/po_payment_confirmation.jsf?po_header_id=#{personalPoBean.po_header_id}&payment_method=#{personalPoBean.payment_method}

    My PersonalPoBean class is @ViewScoped bean, and I already have following configuration on pretty-config:

    <url-mapping id=”po_payment_confirmation”>

    <pattern value=”/payment_confirmation” />



    This pretty:link will work on primefaces datatable too, right? I’m trying to integrate prettyfaces to primefaces based on catagay’s suggestion, and it works well so far.



    This is described (probably a bit too briefly) in the docs:

    The following should do what you want.

    <p:link mappingId="po_payment_confirmation">
    <f:param name="po_header_id" value="#{personalPoBean.po_header_id}" />
    <f:param name="payment_method" value="#{personalPoBean.payment_method}" />

    Hope this helps! PS. Tell Catagay thanks ;) Let us know if you have any more issues!



    Yes, PrettyFaces links work from inside a datatable without problems. Just add the query parameters to your mapping like this:

    <url-mapping id="po_payment_confirmation">
    <pattern value="/payment_confirmation" />
    <query-param name="po_header_id">#{personalPoBean.po_header_id}</query-param>
    <query-param name="payment_method">#{personalPoBean.payment_method}</query-param>

    See this chapter of the PrettyFaces documentation.

    Then you can create links for this mapping like this:

    <pretty:link mappingId="po_payment_confirmation">
    <f:param name="po_header_id" value="#{}" />
    <f:param name="payment_method" value="somePaymentMethod" />
    Click here

    See the chapter on pretty:link for details.


    Ups, concurrent posts! :-)


    Muahahaaaaa :)



    whats about string as Method return and parameters? For example I’m currently writing a forum in Seam 3 and use only Pretty Faces annotations for the views. So if a user creates a new topic I want to redirect to the new topic page but I have to pass the topic parameter somehow in return “pretty:board_topic”. Any ideas? I prefer to keep everything annotation based!




    In this case you will simply have to write the desired value to the corresponding bean property before returning from your action method. When PrettyFaces builds the URL (for example board_topic) all parameter values for the mapping are extracted from the referenced bean properties.

    See this part of the documentation for details:


    Didnt get it to work. Please let clear that out. If I use this in my case:



    return “pretty:board_topic”;

    I set the value for boardNewTopicAction.forumPattern!

    But for board_topic the mapping requires the value for boardTopicAction.forumPattern. So finally I get the error:

    PrettyFaces: Exception occurred while building URL for MappingId < board_topic >, Required value < #{boardTopicAction.forumPattern} > was null


    If you return pretty:board_topic from your action method, you will have to populate the value of #{boardTopicAction.forumPattern}. Something like this:

    public class SomeBeanWithActionMethod {

    private BoardTopicAction boardTopicAction;

    public void myActionMethod() {

    // do some more stuff

    // navigation
    return "pretty:board_topic";



    Please post some more of you code if this still doesn’t work.


    Works fine.

    Thanks for the quick help :)

Viewing 10 posts - 1 through 10 (of 10 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.