tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aidas Semezys <aidas.seme...@gmail.com>
Subject Re: How to map the servlet in web.xml
Date Sat, 27 Nov 2004 11:57:07 GMT
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 <ayyanar@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


Mime
View raw message