1、get请求:
1)jsp设置
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
2)服务器端:
在server.xml中的URLEncoding的设置
<Connector connectionTimeout=“20000” post="8080" protocol="HTTP/1.1" redirectPort="8443" URLEncoding="UTF-8"/>
2、post请求:
dopost函数中(加上下面一句)
request.setChatacterEncoding("UTF-8");