• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.jsp file becomes .jsf file?

 
peter tong
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just download the myfaces-example-blank-1.1.6.war and run on tomcat 6.18, from the IE address bar, all file has .jsf extension (e.g. http://localhost:8080/myfaces-example-blank-1.1.6/helloWorld.jsf) but in the source, all file is .jsp extension.
so why it becomes .jsf extension when seens in IE address bar?

also, in web.xml

the url-pattern is *.jsf,
but in examples-config.xml,

the <to-view-id> is *.jsp!!
so why the servlet url-pattern is *.jsf?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're making a very common mistake. A URL is not a filesystem path. It's a path-like expression intended to locate a resource.

In J2EE, a URL pattern is used to identify the application resource that should receive the URL. In the case of JSF, that resource will be the JSF servlet, because we've specified (using the servlet-mapping) that URLs ending with ".jsf" will be routed to the JSF servlet.

The JSF servlet will dissect the URL and make its own decisions on how to fulfill the URL request. That process will include altering the URL to form a WAR resource path. In an "exploded" WAR, that path will be a filename path (the filename of the JSP) relative to the place where the WAR is deployed. In a standard WAR, it will be the relative location within the WAR of the JSP corresponding to that URL.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moreover, when the JSF servlet dissects the URL as Tim says, it will deduce the name of the view to render. The default mechanism will be to remove the URL suffix, and replace it by its own suffix, which defaults to ".jsp". (This suffix can be overridden via a context parameter).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic