用post 方法提交时:
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
只需要加上 req.setCharacterEncoding("UTF-8");
用get方法提时:
String uname = req.getParameter("uname"); //uname 为表单中的的属性值为uname
uname = new String(uname.getBytes("ISO-8859-1"),"UTF-8");