• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xHtml and Facelets

 
Justin Rundle
Ranch Hand
Posts: 123
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there, quick newbie question. I recently downloaded the ICEFaces 2.0.0 alpha distributions and was looking at the example apps. Some of the files are as follows:

web.xml


index.jsp


So my questions is that when we start the app and navigate to the app, the app will automatically redirect to index.jsp (as defined in the web.xml welcome-file-list) and then the index.jsp page will redirect to showcase.jsf. HOWEVER there is no showcase.jsf file within the project, only showcase.xhtml.

showcase.xhtml:


How does the facelets view handler know to map files with *.jsf extension to *.xhtml files?

Thanks, any feedback will be appreciated.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Like a lot of people, however, you're mistaking a URL for a file. You shouldn't have any "files" in your project whose names end with ".jsf". However, if you're configured with the URL pattern "*.jsf", incoming URLs with ".jsf" at the end of them will be routed to the Faces Servlet, which will then parse out the URL and locate the corresponding JSP or xhtml file.
 
Justin Rundle
Ranch Hand
Posts: 123
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So in the example does the Faces Servlet parse the "showcase.jsf" into "showcase.xhtml"?

And more so what if your file didnt end in *.xhtml?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Justin Rundle wrote:So in the example does the Faces Servlet parse the "showcase.jsf" into "showcase.xhtml"?

And more so what if your file didnt end in *.xhtml?


Well, technically, parsing is only part of what it does. The FacesServlet parses, then transforms, and finally resolves using the transformed name as a WAR resource pathname.

Truthfully, I haven't ever dug down that deep, but if the file didn't end with ".xhtm", then the attempt to open "showcase.xhtml" would fail, resulting in a 404 (Resource Not Found) error. Although for all I actually know, it first checks for a "showcase.jsp" file as an alternative before giving up. I've never checked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic