Dispatcher for Filter Mapping

匿名 (未验证) 提交于 2019-12-03 03:06:01

问题:

I have an app written for Servlet Spec 2.4 with an old webserver designed for Servlet Spec 2.3. The web.xml file has the following syntax:

<filter-mapping>      <filter-name>sitemesh</filter-name>       <url-pattern>*.action</url-pattern>        <dispatcher>REQUEST</dispatcher>         <dispatcher>FORWARD</dispatcher>  </filter-mapping>  

How can I re-write this mapping to be servlet 2.3 compliant?

回答1:

You can just remove the <dispatcher> entries. The Servlet 2.3 filter by default dispatches on everything and that's just okay. Sitemesh even mentions at its own site that it's compatible with Servlet 2.3. Here's an extract from their site:

SiteMesh is a Servlet Filter and therefore requires a container that conforms to the Servlet 2.3 specification.



回答2:

Just remove the <dispatcher> tags.

Servlet 2.3 doesn't support dispatchers. If you don't do include, it doesn't make any difference. If you do have included servlet/JSP, you need to rename them so they are not filtered to get the exact behavior as 2.4.



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