Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Martin Jondzic
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm experiencing problem with Pretty Faces URL mappings.

I have one managed bean with the following mappings:



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.



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!
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Martin Jondzic, welcome to JavaRanch.

I do not know the Pretty Faces but maybe the pattern need to finish with the "/"?

How is the mapping in the JBoss 5 that you told about? Is it ending with the "/" also?
 
Martin Jondzic
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Hebert,

thanks for reply!

Here is JBoss 5.1 configuration (done via XML):



The only difference is the extension (jsf instead of xhtml), but I already tried with jsf and had no success.



 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe your could check the JavaDoc and see if the "/" is required for annotations.
 
Martin Jondzic
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I already tried to make configuration via XML for JSF 2.0 (JBoss 6.x), but just got the same error, so I guess the problem is not related to annotations.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, the ".xhtml" is wrong. That's the resource name, not the URL name. So ".jsf" is what you need, or you're likely to end up with the View being improperly processed.

Secondly, when you add a parameter to the URL, that, too forms part of the package. But URL parameters aren't mapped at the class level, they're mapped at the method level. The method annotation is what binds a given parameter name to its associated property (which may or may not be the same name). A side benefit is that by requiring explicit declaration, Bad Guys can't hack into the system as easily because they can't exploit sensitive properties never intended for external manipulation.
 
Martin Jondzic
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hm..very interesting.

When I added the following mapping



I was able to retrieve search results using: http://ip:port/search.jsf?keywords=keyword.

I don't understand why the mapping "/search/search.jsf" to "/search" doesn't work, but doesn't matter (for now).

Anyways, Tim, thank you for your suggestions, they were helpful!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!