在tomcat的conf/server.xml 中找到
<Connector maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" URIEncoding="utf-8"/>
加入 URIEncoding="utf-8",如上.重啓tomcat.
這裏是解決GET方式獲取UTF-8的問題。如果在post方式下沒有問題,而在get下有問題,一般可以這樣解決。
另外,請問樓主request.getParameter("name")和etQueryString()是否中文是在哪裏看的?在debug下從變量中看的?還是頁面中看的?或是數據庫中看的?
這個是否亂碼與你看的環境有關係,如果你是用的eclipse,必須要設置console窗口也爲utf-8輸出才能正確看到中文.