jsp乱码 UTF-8

Tomcat/config/server.xml  设置

<Connector port="8080" protocol="HTTP/1.1"
               maxThreads="150" connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8"/>

Jsp 页面 :

 <%@ page contentType="text/html;   charset=UTF-8"%>

 

有时用 request.setCharacterEncoding("UTF-8"); 不管用的原因可能是:这句话,应当放到request.getParameter(""); 之前

 

你可能感兴趣的:(jsp)