可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.