• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xHtml and Facelets

 
Ranch Hand
Posts: 123
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic