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]

Reply via email to