Forums Register Login

xHtml and Facelets

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send


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.
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
 

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.
Right! We're on it! Let's get to work tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3855 times.
Similar Threads
*.faces suffix mapping
Error JSF 2.1: java.io.FileNotFoundException:*/*.xhtml Not Found in ExternalContext
JSF, Facelets losing context after reload
Primefaces setup causing problems JSF 2.0
Facelets custom tag not recognized ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:31:42.