页面请求过滤器
来源:互联网 发布:vb从入门到精通第三版 编辑:程序博客网 时间:2024/06/07 10:21
代码部分:
package com.neusoft.trainingcenter.hr.utils;
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;
/**
* Example filter that sets the character encoding to be used in parsing the
* incoming request
*/
public class SetCharacterEncodingFilter implements Filter {
/**
* Take this filter out of service.
*/
public void destroy() {
}
/**
* Select and set (if specified) the character encoding to be used to
* interpret request parameters for this request.
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("GBK");
// 传递控制到下一个过滤器
chain.doFilter(request, response);
}
public void init(FilterConfig filterConfig) throws ServletException {
}
}
配置文件中web.xml
Set Character Encoding
com.neusoft.trainingcenter.hr.utils.SetCharacterEncodingFilter
Set Character Encoding
/*
- 页面请求过滤器
- 过滤器 打印请求日志
- filter请求参数过滤器
- 过滤器过滤请求.jsp
- Filter过滤器 过滤请求
- 过滤器-页面访问次数
- 不缓存页面过滤器
- HTTP请求过滤器FreeBSD accf_http)
- 13. Servlet 请求/响应过滤器
- jsp页面中文编码过滤器
- 页面编码过滤器和配置
- Browser 不缓存页面过滤器
- JSP页面统一编码过滤器
- 过滤器实现页面静态化
- java过滤器对ext异步请求跳转
- java使用过滤器实现 请求转发
- 过滤器实现get请求乱码问题
- 过滤器实现get请求乱码问题
- PermGen space错误解决方法
- Android 多点触摸接口
- 黑马程序员---JavaScript和c#有关字符串replace的差异
- jcs配置
- android 自定义dialog,窗口动画
- 页面请求过滤器
- C++、Objective-C 混合编程
- C#操作Excel文件(读取Excel,写入Excel) .
- HttpWatch学习笔记一
- DB数据库语句,在这里直接把老师写的拷过来了,要配置数据库连接池
- DAOException 和ServiceException
- linux下常用命令
- 我与你同在 保重
- HttpWatch学习笔记二