You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by JS...@vinu.edu on 2003/01/09 17:33:44 UTC

How do I set a default servlet?

I would like to setup my servlet server to point anyone that accesses the
default url to be sent to a certain servlet. For example if someone typed
http://localhost/ then it would take them right to
http://localhost/servlet/myservlet . I'm guessing this is done through the
web.xml in the conf directory, but is there a better way, like in the
applications web.xml. Either way hows the best way to accomplish this?
Thanks.


Thank You,

Justin A. Stanczak
Web Manager
Shake Learning Resource Center
Vincennes University
(812)888-5813



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How do I set a default servlet?

Posted by Bill Barker <wb...@wilshire.com>.
Setting the default servlet is really easy.  You just specify:
<servlet>
  <servlet-name>myservlet</servlet-name>
  <servlet-class>myservlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>myservlet</servlet-name>
  <url-pattern>/</url-pattern>
</servlet-mapping>

The problem is that this is almost certainly not what you want.  This will
invoke 'myservlet' for any URL that doesn't match any other servlet-mapping
(including static-content).

It looks like you want to have your welcome-file specified as a Servlet.
This is only currently supported in Tomcat 3.3.2-dev (aka nightly), and
Tomcat 5.x.
<JS...@vinu.edu> wrote in message
news:OF82399492.7D89FAD8-ON05256CA9.005A5EB4@vinu.edu...
> I would like to setup my servlet server to point anyone that accesses the
> default url to be sent to a certain servlet. For example if someone typed
> http://localhost/ then it would take them right to
> http://localhost/servlet/myservlet . I'm guessing this is done through the
> web.xml in the conf directory, but is there a better way, like in the
> applications web.xml. Either way hows the best way to accomplish this?
> Thanks.
>
>
> Thank You,
>
> Justin A. Stanczak
> Web Manager
> Shake Learning Resource Center
> Vincennes University
> (812)888-5813




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>