aspose file tools*
The moose likes JSF and the fly likes .jsp file becomes .jsf file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark ".jsp file becomes .jsf file?" Watch ".jsp file becomes .jsf file?" New topic
Author

.jsp file becomes .jsf file?

peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240
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

Joined: Jun 25, 2001
Posts: 16250
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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).


[My Blog]
All roads lead to JavaRanch
 
 
subject: .jsp file becomes .jsf file?