1.在数据库链接字符串上要形如:jdbc:mysql://localhost:3306/db?useUnicode=true&characterEncoding=UTF-8(注意要加characterEncoding=UTF-8)
2.在数据库表和相应的字段都要的charset要选择utf8(字段也要加)
3.在servlet的java中去参数时要加上:httpServletRequest.setCharacterEncoding("UTF-8");
4.jsp页面要加上字符集: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>