BaseWeb06-JSP
来源:互联网 发布:php 类destroy 编辑:程序博客网 时间:2024/06/16 05:26
过滤器
package com.chb.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;public class CharacterEncodingFilter implements Filter{ protected String encoding = null; public void destroy() { this.encoding = null; } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { request.setCharacterEncoding(this.encoding); chain.doFilter(request, response); } /** * 初始化参数,从init-param */ public void init(FilterConfig filterConfig) throws ServletException { this.encoding = filterConfig.getInitParameter("encoding"); if (this.encoding == null || "".equals(encoding.trim())) { this.encoding = "UTF-8"; } }}
在web.xml中设置filter的配置
阅读全文
0 0
- BaseWeb06-JSP
- JSP
- JSP
- jsp
- JSP
- JSP
- jsp
- Jsp
- JSP
- jsp
- jsp
- jsp
- JSP
- JSP
- jsp
- jsp
- JSP
- jsp
- Python 练习实例17
- 自定义View(01)
- FZU 1857 Clock in the mirror(模拟)
- Python 练习实例18
- $(function 和 function的区别
- BaseWeb06-JSP
- sublime text3配置Python3.5开发环境
- HDOJ 1785 You Are All Excellent
- windows和linux分区脚本
- AI加速器相关论文1:《DianNao: A Small-Footprint High-Throughput Accelerator for Ubiquitous Machine-Learning》
- 【字节流,高效流】
- 二维码在线生成
- java 反射机制-学习笔记(9)
- 标签传播(阅读笔记)