utf-8 乱码的问题
通过 url传值出现乱码
通过很多方法都没有解决
请高手帮看一下
页面:/test.jsp
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html>
<head>
<title>JSP for HuariForm form</title>
<META http-equiv=Content-Type content="text/html;charset=UTF-8">
</head>
name : <input type="text" name = "name"/>
tiaijao <input type="button" name = "button" onClick="tiao();"/>
<script>
function tiao()
{
window.location="/utf/data.jsp?name="+"中国";
}
</script>
</html>
页面:/data.jsp
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'data.jsp' starting page</title>
<META http-equiv=Content-Type content="text/html;charset=UTF-8">
</head>
<% request.setCharacterEncoding("UTF-8");
String name = request.getParameter("name");
%>
<body>
<% out.println(name); %><br>
</body>
</html>
现在完成从/test.jsp 跳到 data/jsp
输出结果:中国
急求!!!!!!!!!!!!!
------解决方案--------------------
确定你安装了jdk,在MyEclipse里把java的jre倒到你的项目里
在你的jsp头上加上<%@ page import="java.net.*" %>就可以了,
------解决方案--------------------
<%@ page import="java.net.*" %>
这个是肯定可以找到的`~这样就成了