Search code examples
jsfprettyfaces

PrettyFaces pass variables. How to fix it?


I spent a lot of time but I can't fix what exacly I do wrong with PrettyFaces configuration. I have the following rule in pretty-config.xml:

<url-mapping id="administrator_comments"> 
      <pattern value="/comments/{someVariableName}" /> 
      <view-id value="/faces/backend/comments/comments" />
</url-mapping>

and now I would like to test this using following url:

http://localhost:8080/myapplication/comments/test

and I get 404 NOT FOUND. What am I doing wrong? I tried everything but can't understand why that happens. I am doing exactly the same PrettyFaces examples.


Solution

  • You are missing the # character for the EL expression and the file extension of your view. Try:

    <url-mapping id="administrator_comments"> 
      <pattern value="/comments/#{someVariableName}" /> 
      <view-id value="/faces/backend/comments/comments.xhtml" />
    </url-mapping>