
Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
> > I find in some /WEB-INF/web.xml,
> > there are 2 different servlets mapping to the same url-pattern.
>
> This shouldn't happen. Can you give an example? Maybe there's
> something else really happening there.
of course.
example:
<!-- Standard Action Servlet Configuration (with debugging) -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>com.xxxx.webapp.common.struts.XXServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>validating</param-name>
<param-value>@xx.struts.validate.dtd@</param-value>
</init-param>
<init-param>
<param-name>xx.config.root</param-name>
<param-value>@xx.config.root@</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>action_tmp</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>action_tmp</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
any ideas?
-sods
Chris Smith - 09 Jan 2006 06:57 GMT
> <!-- Standard Action Servlet Mapping -->
> <servlet-mapping>
[quoted text clipped - 5 lines]
> <url-pattern>*.do</url-pattern>
> </servlet-mapping>
This is incorrect. I don't see anything in the servlet specification
that specifically defines how a servlet container will deal with this
situation, but there are several statements that imply that it should
choose the first mapping and ignore the second one. However, since that
isn't stated clearly, if such a behavior were observed for some specific
implementation, it would be better to remove the second unused mapping
element to avoid confusion and potential for the web application to
break on future versions of the servlet container.

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation