Search code examples
jsf-2mappingjboss6.xprettyfaces

Cannot make URL mapping using Pretty Faces 3.3.2, JSF 2.0, JBoss 6.1.0 final


I'm experiencing problem with Pretty Faces URL mappings.

I have one managed bean with the following mappings:

@ManagedBean
@RequestScoped
@URLMapping(id = "search", pattern = "/search/", viewId = "/search/search.xhtml")

And it works fine when I go to http://ip/search/?keywords=word.

However, when I try to change mapping pattern, I got an error.

@ManagedBean
@RequestScoped
@URLMapping(id = "search", pattern = "/search", viewId = "/search/search.xhtml")

I expect that the http://ip/search?keywords=word gives the same response as the link above, but unfortunately I get 404 HTTP error.

search.xhtml is in WebContent/search/ folder of Web project deployed on JBoss 6.1.0 final.

The interesting thing is when I use JBoss 5.1.0 and Pretty Faces 3.2.0 and JSF 1.2, the mapping works fine (of course, all mappings are done via XML configuration in this case).

I would appreciate any answer, thanks!


Solution

  • There is a conflict between the folder name, in which the .xhtml file is stored, and the pattern value, so if the folder name is the same as the pattern value, the mapping doesn't work.

    In my case, I had to change the folder name search to search_pages and the mapping started to work fine - it is possible now to visit http://ip:port/search?keywords=keyword and to get appropriate results.

    I don't know if this behavior is assumed for Pretty Filter, but, for me, it looks a little bit strange.