You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aidas Semezys <ai...@gmail.com> on 2004/11/27 12:57:07 UTC

Re: How to map the servlet in web.xml

You have to declare every servlet with separate <servlet/> element
and map all of them with different url patterns:

<servlet>
    <servlet-name>name_1</servlet-name>
    <servlet-class>class_1</servlet-class>
</servelt>
<servlet>
    <servlet-name>name_2</servlet-name>
    <servlet-class>class_2</servlet-class>
</servelt>
....
<servlet>
    <servlet-name>name_N</servlet-name>
    <servlet-class>class_N</servlet-class>
</servelt>
<servlet-mapping>
    <servlet-name>name_1</servlet-name>
    <url-pattern>url_pattern_1</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>name_2</servlet-name>
    <url-pattern>url_pattern_2</url-pattern>
</servlet-mapping>
...
<servlet-mapping>
    <servlet-name>name_N</servlet-name>
    <url-pattern>url_pattern_N</url-pattern>
</servlet-mapping>

You can not map several servlets on the same url pattern, cause this creates
disambiguity. It is a non-deterministic aproach. And in our context
(Java web application
context) it is not a solvable problem :]] Khe, khe

Peace,
Aidas


inr <ay...@4sight-tech.com> wrote:
> Hai all,
> 
> +--Root
>      +--Web-Inf
>             +--Classes
>                  --HelloWorld.class
>                  +--servlet
>                       +--myservlet
>                             --Myservlet.class
> 
>          I am using the following servlet mapping in my webApplication
> Deployment Descriptor web.xml,  when i attempt to use /justtesting the
> sevlet produces the respone in Browser
> 
>  <servlet>
>         <servlet-name>HelloWorld</servlet-name>
>         <servlet-class>HelloWorld</servlet-class>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>HelloWorld</servlet-name>
>         <url-pattern>/justtesting</url-pattern>
> </servlet-mapping>
> 
> if i want to map a Group of  Servlet E.g the servlets under the folder
> Root/Web-Inf/Classes/servlet/....
> 
> what i Should do..
> 
> Thanks for ever,
> inr
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

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