Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

configuration doubt

 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
Pie
Posts: 18091
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the explanation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic