It's not a secret anymore!
The moose likes JSF and the fly likes configuration doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "configuration doubt" Watch "configuration doubt" New topic

configuration doubt

Pavel Kubal
Ranch Hand

Joined: Mar 13, 2004
Posts: 360

I'have used JSF many times, but there is one thing I'm not certain of. It concerns configuration in web.xml, where we match FacesServlet with *.jsf extension or something like that. But after that we create perfectly working JSF pages with the .jsp extension. Why does it work?

I searched through google, but without any success. Thanks for your replies.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Because you're making the common - and invalid - assumption that the app server is a file server. The "JSF" suffix on the URL causes the app server to route the request to the JSF servlet. The JSF servlet can do anything it wants, but what it wants is to build the JSF context, invoke the methods required by the inbound request, and then use the navigation map to determine which JSP to use for the output template.

You can setup the app to look like it's going straight to the JSP, but it's not. Which is why you'll bomb if you code a JSF URL ending with ".jsp" instead of ".jsf". Ending the URL with JSF causes the JSP to be invoked directly by the app server instead of indirectly by the JSF servlet, and the app server doesn't set up the JSF context.

An IDE is no substitute for an Intelligent Developer.
Pavel Kubal
Ranch Hand

Joined: Mar 13, 2004
Posts: 360
Thanks for the explanation.
I agree. Here's the link:
subject: configuration doubt
jQuery in Action, 3rd edition