---servlet 文件
package com.encoding;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
 
public class Encoding  implements javax.servlet.Filter {
     public void destroy() {
          / / TODO Auto-generated method stub
     }
     public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
          request .setCharacterEncoding("GBK");
          chain.doFilter(request, response);
     }
     public void init(FilterConfig arg0) throws ServletException {
          // TODO Auto-generated method stub
     }
}
---XML配置文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
      
   <!-- 中文乱码过滤处理 -->
    <filter>
        <filter-name>encoding</filter-name>
        <filter-class>
            com.encoding;.Encoding
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>encoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
 
</web-app>
减肥瘦身品总汇
   
值得信赖*脉脉美妆*正品现货谢绝讲价
   
〓深港商盟〓名品欧衣坊(美国休闲品牌AF系列)
   
QQ三国游戏币及道具专卖店
   
小脸红红的瘦身旗舰店
	posted on 2009-04-14 09:16 
龙华城 阅读(1360) 
评论(0)  编辑  收藏