JavaScud | Forum | JIRA | Blog |
  Dashboard > WebWork2文档中文化计划 > ... > Configuration Files > web.xml
  WebWork2文档中文化计划 Log In View a printable version of the current page.  
  web.xml
Added by 黑灵, last edited by scud on May 18, 2006  (view change)
Labels: 
(None)

如果要用到WebWork的最新特性并且不需要考虑向后兼容问题,您只需要在web.xml中添加一个单独的过滤器.如果要用JSP的话,还需要一个添加标签库.但是如果是从2.1.7或更早的版本升级的Web应用程序,那么需要做更多的工作使程序能够正常运行.更多信息请查看web.xml 2.1.x兼容性.

过滤器配置如下:

<filter>
    <filter-name>webwork</filter-name>
    <filter-class>com.opensymphony.webwork.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
    <filter-name>webwork</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

如果要用到JSP,标签库配置如下:

<!--
    一般来说这个配置不是必需的,因为标签库已经被包括在webwork.jar中了.
    如果您真的需要在web.xml中配置标签库,可以把webwork/src/java/META-INF/taglib.tld文件复制为您的应用程序的WEB-INF目录下,命名为webwork.tld
 -->
<taglib>
    <taglib-uri>webwork</taglib-uri>
    <taglib-location>/WEB-INF/webwork.tld</taglib-location>
</taglib>

译者注:如果是servlet2.4,标签库配置如下:

<jsp-config>
   <taglib>
      <taglib-uri>webwork</taglib-uri>
      <taglib-location>/WEB-INF/webwork.tld</taglib-location>
   </taglib>
</jsp-config>
如果你要使用 SiteMesh 进行页面装饰,你应该需要添加一些 额外的过滤器
web.xml 2.1.x compatibility (WebWork2文档中文化计划)
Site running on a free Atlassian Confluence Open Source Project License granted to WebWork China. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.3 Build:#808 May 29, 2007) - Bug/feature request - Contact Administrators