JSP乱码(小记)

 

Post提交乱码:

  设置请求的编码方式:

    request.setCharacterEncoding("utf-8");

  设置响应的编码方式:

    response.setCharacterEncoding("utf-8");

    或者

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>

 

Get提交乱码:

  在tomcat服务器中,配置conf/server.xml,

  <Connector port="8080" protocol="HTTP/1.1"
  connectionTimeout="20000"
  redirectPort="8443" URIEncoding="UTF-8" />

posted @ 2013-09-10 00:00  徒徒的实验室  阅读(169)  评论(0编辑  收藏  举报