This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Please help me to understand. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Please help me to understand." Watch "Please help me to understand." New topic
Author

Please help me to understand.

Jaik Singh
Greenhorn

Joined: Sep 22, 2010
Posts: 20
Hey Guys,
Could you please make me understand the relationship between the few below entries in web.xml and the default URL generated when we deploy the application on the server.


Entries in web.xml

=================================

<display-name>PopUp</display-name>
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>

=============================================

This config generate the default URL http://localhost:8080/PopUp/.

I have file, index.xhtml but to make this application run on browser I have to edit the URL and write http://localhost:8080/PopUp/index.jsf.

What should I need to changes in the above config so that if I deploy this application on browser the default URL generated should be http://localhost:8080/PopUp/index.jsf.

Thanks and Regards
Jaikrat Singh TARIYAL.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

You'll get more answers if you pick a question topic that's more specific to your problem. Non-descriptive topics like "About JSF" or "Help me" don't get looked at as much.

As its name implies, "welcome-file" must be a FILE (WAR resource), not a URL.

Pages that are displayed by direct action of the webapp container, such as the welcome page, login/loginfail, and error pages don't get routed through the normal URL process. In particular, they don't go through the FacesServlet, so JSF cannot be used.

The way around that is to make the welcome-file be a straight HTML or JSP file that redirects to your JSF welcome page. It's annoying, but that's how it works.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jaik Singh
Greenhorn

Joined: Sep 22, 2010
Posts: 20
Hey Tim, will remember your suggestion by next time.

Thanks for your reply. Really helped.

Thanks
Jaikrat Singh
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Please help me to understand.
 
Similar Threads
Tomcat 5.5 SEVERE: Error listenerStart
Error with JBoss and JSF(My Page does not work)
No nothing works
Starting a JSF 2.0 project with PrimeFaces 2.2. M1 and Glassfish 3.0
URL Pattern for JSF pages