首页 > 代码库 > html向servlet传乱码解决办法

html向servlet传乱码解决办法

html 设置为utf-8格式

<meta http-equiv="content-type" content="text/html;charset=UTF-8">

 

myeclipse里可以修改jsp编码格式,

request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");

String username = (String)request.getParameter("username");
username = new String(username.getBytes("iso8859-1"),"utf-8");

 

html向servlet传乱码解决办法