随笔 - 6  文章 - 129  trackbacks - 0
<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

常用链接

留言簿(14)

随笔档案(6)

文章分类(467)

文章档案(423)

相册

收藏夹(18)

JAVA

搜索

  •  

积分与排名

  • 积分 - 821501
  • 排名 - 49

最新评论

阅读排行榜

评论排行榜

web.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
 version="2.4">

    <filter>
      <filter-name>CharacterEncodingFilter</filter-name>
      <filter-class>
           org.springframework.web.filter.CharacterEncodingFilter
      </filter-class>
      init-param>
       <param-name>encoding</param-name>
       <param-value>GB2312</param-value>
      </init-param>
      <init-param>
       <param-name>forceEncoding</param-name>
       <param-value>true</param-value>
      </init-param>
     </filter>
<!-- 要过滤得类型 -->
  <filter-mapping>
  <filter-name>SetCharacterEncoding</filter-name>
  <url-pattern>*.jsp</url-pattern>
  </filter-mapping>

</web-app>
public class CharacterEncodingFilter
extends OncePerRequestFilter

Servlet 2.3/2.4 Filter that allows one to specify a character encoding for requests. This is useful because current browsers typically do not set a character encoding even if specified in the HTML page or form.

This filter can either apply its encoding if the request does not already specify an encoding, or enforce this filter's encoding in any case ("forceEncoding"="true"). In the latter case, the encoding will also be applied as default response encoding on Servlet 2.4+ containers (although this will usually be overridden by a full content type set in the view).



posted on 2007-09-12 23:27 Ke 阅读(3201) 评论(1)  编辑  收藏 所属分类: spring

FeedBack:
# re: org.springframework.web.filter.CharacterEncodingFilter 2008-10-24 19:37 
哦也  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: