jsp传到数据库中乱码的处理
来源:互联网 发布:室内设计网络培训 编辑:程序博客网 时间:2024/05/20 22:00
1.新建一个类:
- package zz;
- 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;
- /**
- * Filter that sets the character encoding to be used in parsing the
- * incoming request
- */
- public class SetCharacterEncodingFilter implements Filter {
- protected String encoding = null;
- protected FilterConfig filterConfig = null;
- public void destroy() {}
- public void init(FilterConfig filterConfig) throws ServletException {
- this.filterConfig = filterConfig;
- this.encoding = filterConfig.getInitParameter("encoding");
- }
- /**
- * 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(encoding);
- response.setCharacterEncoding(encoding);
- chain.doFilter(request,response);
- }
- }
<filter>
<filter-name>SetCharacterEncoding</filter-name>
<filter-class>com.bigdata.financial.filter.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SetCharacterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
0 0
- jsp传到数据库中乱码的处理
- JSP传到后台乱码的3中方法
- js中的中文传到jsp中乱码
- JSP页面上的中文数据传到后台乱码处理汇总
- jsp中不同提交方式的中文乱码处理方法及数据库乱码处理方法
- 应用服务器tomcat编码引起的JSP中汉字传到后台乱码问题
- JSP将页面checkbox选择的多项数据传到Action中进行处理
- jsp页面传到后台的参数为乱码
- jsp&servlet中乱码的简单处理
- jsp数据库中文乱码处理
- jsp乱码的处理
- 数据库以及JSP页面乱码问题的处理
- jsp中处理中文乱码
- get请求中包含的汉字传到服务器后乱码
- 解决javaWEB中前台数据传到后台乱码的问题
- 从jsp页面传到后台乱码问题
- jsp 页面中文 传到后台 乱码问题解决
- JSP页面中中文乱码的处理以及表单中中文乱码的处理方法
- HDU 1040
- Palindrome Number
- Eclipse设置项目/文件初始化编码,改变已有文件编码
- 敏捷开发中对进度的把握
- 触发器引起DML性能大降亦可用10046捕获元凶SQL
- jsp传到数据库中乱码的处理
- 线程的优先级
- linux下安装apche的安装
- Linux学习,第二天(文件权限),学习笔记
- 对象序列化
- dijkstra算法
- 自己使用popupwindow时遇到的
- VARIANT的简便介绍
- jhgjgjhgjkhhghgfjhfgdgj