1、下载:
下载地址为urlrewrite/#download
2、配置
在struts的filter-mapping中加入以下就可以了
- <filter-mapping>
- <filter-name>struts2 filter-name>
- <url-pattern>*.do url-pattern>
- <dispatcher>REQUEST dispatcher>
- <dispatcher>FORWARD dispatcher>
- <dispatcher>INCLUDE dispatcher>
- filter-mapping>
struts2
*.do
REQUEST
FORWARD
INCLUDE
如下:
-
- <filter>
- <filter-name>encodingFilterfilter-name>
- <filter-class>
- org.springframework.web.filter.CharacterEncodingFilter
- filter-class>
- <init-param>
- <param-name>encodingparam-name>
- <param-value>UTF-8param-value>
- init-param>
- filter>
-
- <filter>
- <filter-name>osivFilterfilter-name>
- <filter-class>
- org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
- filter-class>
- filter>
-
- <filter>
- <filter-name>UrlRewriteFilterfilter-name>
- <filter-class>
- org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
- filter-class>
- <init-param>
- <param-name>logLevelparam-name>
- <param-value>WARNparam-value>
- init-param>
- filter>
-
- <filter>
- <filter-name>struts2-cleanupfilter-name>
- <filter-class>
- org.apache.struts2.dispatcher.ActionContextCleanUp
- filter-class>
- filter>
- <filter>
- <filter-name>struts2filter-name>
- <filter-class>
- org.apache.struts2.dispatcher.FilterDispatcher
- filter-class>
- filter>
- <filter-mapping>
- <filter-name>encodingFilterfilter-name>
- <url-pattern>/*url-pattern>
- filter-mapping>
-
-
- <filter-mapping>
- <filter-name>osivFilterfilter-name>
- <url-pattern>/*url-pattern>
- filter-mapping>
-
- <filter-mapping>
- <filter-name>UrlRewriteFilterfilter-name>
- <url-pattern>/*url-pattern>
- <dispatcher>REQUESTdispatcher>
- <dispatcher>FORWARDdispatcher>
- filter-mapping>
-
-
- <filter-mapping>
- <filter-name>struts2-cleanupfilter-name>
- <url-pattern>/*url-pattern>
- <dispatcher>REQUESTdispatcher>
- <dispatcher>FORWARDdispatcher>
- filter-mapping>
-
- <filter-mapping>
- <filter-name>struts2 filter-name>
- <url-pattern>/*url-pattern>
- <dispatcher>REQUESTdispatcher>
- <dispatcher>FORWARDdispatcher>
- filter-mapping>
encodingFilter
org.springframework.web.filter.CharacterEncodingFilter
encoding
UTF-8
osivFilter
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
UrlRewriteFilter
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
logLevel
WARN
struts2-cleanup
org.apache.struts2.dispatcher.ActionContextCleanUp
struts2
org.apache.struts2.dispatcher.FilterDispatcher
encodingFilter
/*
osivFilter
/*
UrlRewriteFilter
/*
REQUEST
FORWARD
struts2-cleanup
/*
REQUEST
FORWARD
struts2
/*
REQUEST
FORWARD
引用部分
1、在web.xml中EncodingFilter的位置应该在Struts2的FilterDispatcher之前,道理很简单,要先调整字符集,再进入Action。
2、如果使用Urlrewrite,要指定filter-mapping的dispatcher方式,如下
Struts2
/*
REQUEST
FORWARD
3、在做上传文件的时候,要在web.xml中增加ActionContextCleanUp这个filter,如果不增加,会发生第一次上传取不到文件的情况
struts-cleanup
org.apache.struts2.dispatcher.ActionContextCleanUp
struts-cleanup
/*
按照Struts2的API,filter的顺序是
struts-cleanup filter
SiteMesh filter
FilterDispatcher
相关链接:
阅读(2106) | 评论(0) | 转发(0) |