I need to map the same servlet on two different url. I used netbeans 7.0.1 for managing my whole project, so I used its friendly interface to modify the web.xml file. What netbeans created is this:
<servlet-mapping>
<servlet-name>fred</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>/url</url-pattern>
</servlet-mapping>
This is read by tomcat 5.5 without emitting any error, but only the second pattern works, while the first one is ignored.
Googling I found that the right way for tomcat is this one:
<servlet-mapping>
<servlet-name>fred</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>fred</servlet-name>
<url-pattern>/url</url-pattern>
</servlet-mapping>
So, my questions: is this a bug in tomcat? What syntax do other containers accept?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…