tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Bromley <>
Subject Re: how to set index.faces as welcome-file
Date Tue, 26 Jul 2005 21:19:52 GMT
It took me a while to get welcome files working with the SpringMVC web framework.

I created the attached servlet to get things working properly.  It requires servlet spec 2.4,
and it works by mapping the welcome file to a servlet, WelcomeFileServlet, rather than direct
to a JSP.  The WelcomeFileServlet then forwards it on to the correct servlet, and makes sure
that the requestURI returns the right value (e.g. /index.htm rather than just /) It should
work fine with JSF, if you configure it properly.

Here's an example of how to configure it in web.xml


It works by mapping the index page (index.htm in my case, index.faces or whatever in yours)
to the WelcomeFileServlet:
	<!-- Exact mappings are needed below for the welcome-file feature to work with WelcomeFileServlet.

and then defining the welcome file as 

<!-- This relies on the 2.4 spec allowing mappings to a servlet as opposed to just a real
file (index.htm doesn't exist as a real file in any of the directories this feature is required).
 The WelcomeFileServlet docs have lots of info on the correct setup of that class. -->

Take a look at the docs with the attached file for more.

Hope it helps,

Martin with an 'i' ;-)

Marten Lehmann wrote:
> Hello,
> I tried to put the following into web.xml:
> <welcome-file-list>
>     <welcome-file>index.faces</welcome-file>
> </welcome-file-list>
> But obviously, this doesn't work, because there is no file index.faces, 
> but index.jsp. However, if the index.jsp isn't called through 
> index.faces, the FacesContext isn't used. How can I achieve this as 
> expected? I don't want to use the plain old workaround with an 
> index.html containing a refresh.
> Regards
> Marten
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message