This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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:
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.
How does the facelets view handler know to map files with *.jsf extension to *.xhtml files?
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.
An IDE is no substitute for an Intelligent Developer.
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.