Peter,

Thanks for the example: I had seen examples like this in the archives, which is 
why I thought that I could do what I'm trying to do: I want the same kind of 
behavior you are describing, but with a mapping to the Faces servlet instead.

If the examply you've provided works, any ideas why my JSF setup would not 
work? In my environment, I request "http://localhost:8080/pdm/main.faces";, 
which works fine. If I instead request "http://localhost:8080/pdm/";, it instead 
shows me a directory listing of the files in my web app.

Is there a problem with using a wildcard in my JSF servlet mapping that causes 
it to fail with welcom files? Or is there something inherently odd with JSF 
that makes this impossible to do?

Thanks,

- Tim

-----Original Message-----
From: Peter Menzel <[EMAIL PROTECTED]>
Sent: Nov 8, 2005 6:48 AM
To: Tomcat Users List <users@tomcat.apache.org>
Subject: Re: Use of JSF view in welcome file list

Charlie C.L. King wrote:
> you *MUST* use real files in <welcome-file> instead of a mapped path.
> 

Actually this is not true.

In the <welcome-file-list> you specify only partial URIs in the 
<welcome-file> Elements.
If the Container encounters a request, which does not map to a 
<servlet-mapping> in the DD, it appends each <welcome-file> in the order 
appearing in the list to this partial request and looks, if there is a 
static file OR a <servlet-mapping> which matches the modified request. 
If yes, then this request will be processed. Therefore the first 
matching <welcome-file> wins. If no <welcome-file> matches, the 
container may show a directory listing or 404. Welcome files may not 
contain leading or trailing slashes.

working example:

<servlet>
        <servlet-name>Home</servlet-name>
        <servlet-class>my.servlet.Home</servlet-class>
</servlet>

<servlet-mapping>
        <servlet-name>Home</servlet-name>
        <url-pattern>/home</url-pattern>
</servlet-mapping>

<welcome-file-list>
        <welcome-file>home</welcome-file>
</welcome-file-list>

If a request comes to http://example.com/mywebapp/ ,  the container 
appends "home" to the partial request "/" and matches "/home". The 
my.servlet.Home gets the request.

See servlet Spec SRV 9.10 for more details.

Peter Menzel


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to