JSP页面中输入汉字,servlet里读出来是乱码,编码形式都是UTF-8,为什么啊?
<%@pagelanguage="java"import="java.util.*"pageEncoding="UTF-8"%><%@pagecontentType="t...
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8" %>
servlet中
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String name=request.getParameter("name");
System.out.println(name);
这样输出的name是乱码 展开
<%@ page contentType="text/html; charset=UTF-8" %>
servlet中
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String name=request.getParameter("name");
System.out.println(name);
这样输出的name是乱码 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询