tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TonyC...@comcast.net
Subject Re: Are servlet name and class name required in web.xml for tomcat 5.5?
Date Wed, 25 Jan 2006 16:13:11 GMT

 -------------- Original message ----------------------
From: "Alla Winter" <alla@cobrasource.com>
> For Tomcat 4.x I didn't have to set up anything in web.xml.  But it seems
> that I have to define each servlet name and corresponding class name in
> web.xml in order to make it to work for Tomcat 5.5.  Is that right
> statement? 
> I have a lot of servlets, it seems like it is a lot of work.
> Can not find what info is required in web.xml and what is optional? Can you
> please refer me to that info?
> Thanks 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


Yes, that is correct. Within the <servlet> element you must have the <servlet-name>
element, which can be any unique name you want, and the <servlet-class> element which
has the real class name. Then within the <servlet-mapping> element you must have a <servlet-name>
which is the same as one of the names from the <servlet> section, and you must have
a <url-pattern> element which tells Tomcat the url pattern that it will map to the identified
servlet. Here is an example for a servlet called "Login":

 <servlet>
    <servlet-name>Login</servlet-name>
    <servlet-class>net.homeip.coconets.sessionpkg.Logout</servlet-class>
  </servlet>

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

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


Mime
View raw message