aspose file tools*
The moose likes JSF and the fly likes HTML/JSP to start JSF page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "HTML/JSP to start JSF page" Watch "HTML/JSP to start JSF page" New topic
Author

HTML/JSP to start JSF page

Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
It's not the first time when I see a JSF example starting with something like this:

Is it necessary? Do you use it in real life or only with examples? What's the point? The same applies to JSF 2.0?
Tuna Töre
Ranch Hand

Joined: Aug 17, 2008
Posts: 219

Because the JSF techology build on the J2EE technology and the JSF framework must be started by using URL such as Index.faces.



Users can call Index.html like the code you mentioned and then the FacesServlet will be initialized by mapping Index.faces url to FacesServlet in your web.xml file.
But if you dont want to use refresh the function of HTML code, you can change your FacesServletMapping.

example



By doing that you can for example create a .jsp page under the file structure (/appName/jsf/pages/index.jsp). However by doing that users must know the index page URL


blog: http://tunatore.wordpress.com
SCJP 6.0 + SCWCD 1.5
Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
OK, I got it,
but what's the difference between redirecting from index.html to index.faces and running directly ".../appname/index.faces"? Is it exactly the same?
Tuna Töre
Ranch Hand

Joined: Aug 17, 2008
Posts: 219

Yes, both of them do the same thing.
Initializing the JavaServer Faces framework's FacesContext

Tuna TÖRE
Krystian Gor
Ranch Hand

Joined: Jan 11, 2011
Posts: 30
Thank You.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTML/JSP to start JSF page