You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Fredrik Jonson <pt...@student.bth.se> on 2003/08/07 09:46:48 UTC

Servlet mapping for root directory in a webapp?

Hello, 

I'm trying to get tomcat (from sun's jwsdp1.2) to do a default mapping. 

Ie, in my webbapp /stuff/ I want to get a servlet to serve the root 
"page". As I understand it there is a default servlet that serves 
static content, I do not want to replace that one, but only load a
specific servlet for the root url for my webapp.

I (and a lot of other people, apparently =) have tried:

        <servlet-mapping>
                <servlet-name>MainView</servlet-name>    
                <url-pattern>/</url-pattern>
        </servlet-mapping>

as I found it on a lot of search results, but as I understand it
that pattern is already "taken" by the default servlet. It doesn't
work.

I have had little succes searching google, and the documentation for 
solutions. Is it at all possible, or does everyone just use a dummy
index.html in the root directory and forwards the users to the real
content serving servlet? 

TIA
-- 
Fredrik Jonson


Re: Servlet mapping for root directory in a webapp?

Posted by Fredrik Jonson <pt...@student.bth.se>.
Following up to myself here... 

On Thu, 7 Aug 2003, Fredrik Jonson wrote:

> I'm trying to get tomcat (from sun's jwsdp1.2) to do a default mapping. 
> 
> I (and a lot of other people, apparently =) have tried:
> 
>         <servlet-mapping>
>                 <servlet-name>MainView</servlet-name>    
>                 <url-pattern>/</url-pattern>
>         </servlet-mapping>

Today I changed it to:

         <servlet-mapping>
                 <servlet-name>MainView</servlet-name>
                 <url-pattern>/index.html</url-pattern>
         </servlet-mapping>

And, as I understand it, tomcat(?) returns that servlet mapping for
requests for the root catalog. Well, it is a kind of workaround, but
since it works well enough I'll just accept that and continue. 

But if anyone know more about the magic behind it all, I'd be very
greatful for a thorough explanation of how and why it works. 

TIA & regards, 
-- 
Fredrik Jonson


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Servlet mapping for root directory in a webapp?

Posted by Fredrik Jonson <pt...@student.bth.se>.
Following up to myself here... 

On Thu, 7 Aug 2003, Fredrik Jonson wrote:

> I'm trying to get tomcat (from sun's jwsdp1.2) to do a default mapping. 
> 
> I (and a lot of other people, apparently =) have tried:
> 
>         <servlet-mapping>
>                 <servlet-name>MainView</servlet-name>    
>                 <url-pattern>/</url-pattern>
>         </servlet-mapping>

Today I changed it to:

         <servlet-mapping>
                 <servlet-name>MainView</servlet-name>
                 <url-pattern>/index.html</url-pattern>
         </servlet-mapping>

And, as I understand it, tomcat(?) returns that servlet mapping for
requests for the root catalog. Well, it is a kind of workaround, but
since it works well enough I'll just accept that and continue. 

But if anyone know more about the magic behind it all, I'd be very
greatful for a thorough explanation of how and why it works. 

TIA & regards, 
-- 
Fredrik Jonson