Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML/JSP to start JSF page

 
Krystian Gor
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 220
Eclipse IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Krystian Gor
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 220
Eclipse IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, both of them do the same thing.
Initializing the JavaServer Faces framework's FacesContext

Tuna TÖRE
 
Krystian Gor
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic