常見jsp--servlet中文亂碼

文本正文
//java--->jsp
username=new String(username.trim().getBytes("iso-8859-1"),"utf-8");


//jsp--->jsp
<%=new String(request.getParameter("name").getBytes("ISO-8859-1"),"utf-8") %>

//springMVC,@RequestMapping(java-->jsp)
@RequestMapping(value="/up_user", produces = "application/json; charset=utf-8")

//jsp--->servlet:
resp.setContentType("text/html;charset=utf-8");
	req.setCharacterEncoding("utf-8");
相關文章
相關標籤/搜索