Exclude query-parameters from URL

Splash Forums PrettyFaces Users Exclude query-parameters from URL

This topic contains 1 reply, has 2 voices, and was last updated by  Lincoln Baxter III 11 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #17854



    I don’t want to show query-parameters in URL, but I still need the value in the bean. Is there any way to exclude it from URL through rewritten method or any other way.

    For Example

    <url-mapping id=”viewCategory”>

    <pattern value=”/store/#{ cat : bean.category }/” />



    And URL is

    <h:link outcome=”pretty:viewCategory” value=”View category: Shoes>

    <f:param name=”cat” value=”shoes” />

    <f:param name=”lang” value=”en_US” />


    OUT Put :/store/shoes/?lang=en_US

    My requirement is : /store/shoes/ but also need value of “lang” in my bean(Note: not shown in URL)


    Adnan Javed


    Hi Adnan,

    PrettyFaces doesn’t offer a great solution for this at the moment. You could possibly try to do something using a rewrite processor: http://ocpsoft.com/docs/prettyfaces/3.2.0/en-US/html/inbound_rewriting.html#inbound_rewriting.options

    Your rewrite processor would need to gain access to your internal application’s logic, or the user-session, and set the Language there. Unfortunately this system does not provide access to the current request – so you might have to use some trickery to gain access to the HttpRequest object (and thusly the HttpSession)… This might be an area where improvement is needed.

    In addition to that, it would also need to intercept the ?lang=en_US parameter, remove it, and redirect to the resulting URL.

    1. Intercept ?lang=en_US

    2. Set value in User Session

    3. Return new URL without parameter, causing a redirect to occur (assuming your rewrite rule has been appropriately configured. Read the full chapter on inbound rewriting to learn more about what I mean here.)



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

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

Comments are closed.