• 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

.jsp file becomes .jsf file?

 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
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
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.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic