当前位置: 代码迷 >> Web前端 >> spring相关字符中文乱码和session延时关闭的web.xml配置
  详细解决方案

spring相关字符中文乱码和session延时关闭的web.xml配置

热度:171   发布时间:2012-11-08 08:48:11.0
spring有关字符中文乱码和session延时关闭的web.xml配置

于web.xml中作如下配置:

<!-- 解决中文乱码过滤器 -->
?<filter>
??<filter-name>encodingFilter</filter-name>
??<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
??<init-param>
???<param-name>encoding</param-name>
???<param-value>UTF-8</param-value>
??</init-param>
?</filter>
?<filter-mapping>
??<filter-name>encodingFilter</filter-name>
??<url-pattern>*.do</url-pattern>
?</filter-mapping>
?
<!-- 解决Session关闭的过滤器 -->
?<filter>
??<filter-name>openSessionInView</filter-name>
??<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
?</filter>
?<filter-mapping>
??<filter-name>openSessionInView</filter-name>
??<url-pattern>*.do</url-pattern>
?</filter-mapping>

?<filter-mapping>
??<filter-name>openSessionInView</filter-name>
??<url-pattern>/dwr/*</url-pattern>
?</filter-mapping>

1 楼 gwl3323405 2011-09-30  
一下子就找到我想要的,谢谢LZ分享!
  相关解决方案