many url-pattern for the same servlet

若如初见. 提交于 2019-11-28 08:03:01
Aravind A

I guess it has more to do with the servlet spec the container/netbeans is using rather than being an issue with the container. Your net beans seems to be using the spec 2.5 to construct the servlet mapping and hence you get

<servlet-mapping>
   <servlet-name>fred</servlet-name>
   <url-pattern>*.jsp</url-pattern>
   <url-pattern>/url</url-pattern>
</servlet-mapping>

Read more about this here. It says

Previous versions of the servlet schema allows only a single url-pattern in a filter mapping.For filters mapped to multiple URLs this results in needless repetition of whole mapping clauses.

Satish Dodia

Tomcat container will support 3 url patterns:

  1. complete character sequence
  2. /*
  3. *. ext (star means anything)

/* is recommended for only one single framework

if you use multiple framework then recommended .*

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!