EncodingFilter.java
资源名称:(J2EE)oa.rar [点击查看]
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:1k
源码类别:
Jsp/Servlet
开发平台:
Java
- package com.oa.filter;
- import java.io.IOException;
- import javax.servlet.Filter;
- import javax.servlet.FilterChain;
- import javax.servlet.FilterConfig;
- import javax.servlet.ServletException;
- import javax.servlet.ServletRequest;
- import javax.servlet.ServletResponse;
- /**
- * 编码过滤器
- * @author student
- *
- */
- public class EncodingFilter implements Filter {
- public void init(FilterConfig arg0) throws ServletException {
- // TODO 自动生成方法存根
- }
- /**
- * 过滤方法
- */
- public void doFilter(ServletRequest req, ServletResponse res,
- FilterChain chain) throws IOException, ServletException {
- req.setCharacterEncoding("GBK");
- res.setCharacterEncoding("GBK");
- chain.doFilter(req, res);
- }
- public void destroy() {
- // TODO 自动生成方法存根
- }
- }