1. 更改Tomcat平臺中的字符編碼--servlet.xml中的<connector>中的一個屬性
2. 通過String中的亂碼解決方式來處理
核心句:byte bs[]=name.getBytes("ISO8859-1");//還原出原來 的字節編碼
name=new String(bs,"utf-8");
3. request.setCharacterEncoding("UTF-8");-----必須是post方式
4.通過在web.xml中設置字符參數的方式把法三做活
示例:req.setCharcterEncoding(charset);
在web.xml中配置編碼
****用的較多的是法三的方式,法二是最底層的解決方式get和post都可以但若參數太多太麻煩