General Pattern

Splash Forums PrettyFaces Users General Pattern

This topic contains 2 replies, has 3 voices, and was last updated by  Lincoln Baxter III 10 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #17966


    Hi All,

    I am new to prettyfaces and I really find it very useful.

    I created a test application using netbeans 7 and added prettyfaces to it and it works fine, but I faced a strange behaviour.

    I created a test navigation rule:

    <url-mapping id=”normalBootstrap”>

    <view-id value=”/test.jsf” />

    <pattern value=”/test/#{ /.*/ query : testBean.query }” />


    the above url-mapping pattern works fine and it maps any url that starts with /test/ to /test.jsf and it sets testBean.query correctly.

    but what I really need is to map any url to test.jsf page and I tried to achive this by changing the url-mapping to:

    <url-mapping id=”normalBootstrap”>

    <view-id value=”/test.jsf” />

    <pattern value=”/#{ /.*/ query : testBean.query }” />


    the above url-mapping maps any url to test.jsf, but it will set testBean.query to “test.jsf” which is the view-id !!!!

    is this a usual behaviour of prettyfaces or am I missing something ?

    Thanks in Advance


    I think this happens because the PrettyFilter detects the incoming requests and calls RequestDispatcher.forward() using the view-id of your mapping. This is expected behavior. The forwarded requests will be treated like every other request by the servlet engine and thus will be processed by the PrettyFilter again. But this forwarded request also matches the pattern of your mapping and so the value injected into the bean will be /test.jsf.

    But I’ll have to take a deeper look at the PrettyFaces code to verify this.


    Sorry for being slow to reply. That’s exactly what’s happening. You’ll need to use a negative lookahead to prevent this from occurring.

    <pattern value="/#{ /(?!^test.jsf.*$).*/ query : testBean.query }" />

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

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

Comments are closed.