org.springframework.web.filter.CharacterEncodingFilter

转载 2007年10月08日 21:50:00
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).

 

Spring-web源码解析之Filter-CharacterEncodingFilter

基于4.1.7.RELEASE 在web.xml我们经常看见这么一段 encodingFilter org.springframework.web.filter.Characte...
  • ktlifeng
  • ktlifeng
  • 2016-02-03 17:39:40
  • 2489

Spring在web.xml请求中定义编码(org.springframework.web.filter.CharacterEncodingFilter)

encodingFilter org.springframework.web.filter.CharacterEncodingFilter e...
  • u012959829
  • u012959829
  • 2014-04-28 16:38:51
  • 1601

org.springframework.web.filter.CharacterEncodingFilter详解

很简单很实用的一个过滤器,当前台JSP页面和JAVA代码中使用了不同的字符集进行编码的时候就会出现表单提交的数据或者上传/下载中文名称文件出现乱码的问题,那这个类就可以出场了。 web.xml中配置...
  • zhangrongchao_
  • zhangrongchao_
  • 2015-05-27 09:57:26
  • 14299

Spring为web开发提供的一个类 org.springframework.web.filter.CharacterEncodingFilter

org.springframework.web.filter.CharacterEncodingFilter 是Spring为web开发提供的一个过滤器,主要目的是防止web开发中出现的乱码问题。 ...
  • u013803262
  • u013803262
  • 2016-07-08 16:16:24
  • 2302

org.springframework.web.filter.CharacterEncodingFilter cannot be cast to javax.servlet.Filter报错

Maven开发web项目时调试开启tomcat时爆出异常: java.lang.ClassCastException: org.springframework.web.filter.Character...
  • weflycaoyang
  • weflycaoyang
  • 2015-03-16 22:24:07
  • 4391

解决中文乱码用spring经典编码过滤器org.springframework.web.filter.CharacterEncodingFilter

使用spring的前提下在web.xml中配置    encodingFilter     org.springframework.web.filter.CharacterEncodingFi...
  • fjseryi
  • fjseryi
  • 2013-10-13 16:55:54
  • 5923

spring mvc 在web请求中定义编码(org.springframework.web.filter.CharacterEncodingFilter

Filter 定义 --> Character Encoding filter --> filter> filter-name>encodingFilterfilt...
  • g_blue_wind
  • g_blue_wind
  • 2016-07-27 10:59:42
  • 345

eclispe中的maven项目使用spring报 org.springframework.web.filter.CharacterEncodingFilter 找不到

报错信息如下(我已经在web.xml配置了filter):java.lang.ClassNotFoundException: org.springframework.web.filter.Charac...
  • qq_27292113
  • qq_27292113
  • 2017-06-02 10:51:28
  • 1383

maven重新导入出现java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterEncodingFilter

1.maven重新导入出现java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterEncodingFilte...
  • lzc4869
  • lzc4869
  • 2016-12-07 10:34:02
  • 3786

maven org.springframework.web.filter.CharacterEncodingFilter cannot be cast to javax.servlet.Filter

使用maven将项目部署到tomcat容器,启动的时候报如下错误:严重: Exception starting filter charsetFilter java.lang.ClassCastExce...
  • wenguang_hz
  • wenguang_hz
  • 2015-05-29 11:04:58
  • 16254
收藏助手
不良信息举报
您举报文章:org.springframework.web.filter.CharacterEncodingFilter
举报原因:
原因补充:

(最多只允许输入30个字)