问下Jsp 编码问题

chan10 chan10 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在jsp传递参数过程中,最后获得的中文字符总是乱码,
问该如何解决啊。
示例中是index1.jsp的输入数据,传递到index2.jsp时,将出现中文乱码。

index1.jsp

<%@ page contentType="text/html; charset=GB2312" pageEncoding="gb2312"%>

<html>
<head>
<title>POS</title>
</head>
<body>
<form name="frm1">
<input type="input" name="sss" value="" />
<input type="button" value="submit" onclick="confirm();" />
</form>
</body>
</html>
<script language="javascript">
function confirm()
{
var value = document.frm1.sss.value;
alert("-----------" + value);
var url="index2.jsp?val="+value;
document.location.href=url;
}
</script>



index2.jsp

<%@ page contentType="text/html; charset=GB2312" pageEncoding="gb2312"%>

<html>
<head>
<title>POS2</title>
</head>
<body>
Value---<%=request.getParameter("val")%>
</body>
</html>


...全文
评论 43
收藏 已收藏
分享
返回顶部
chan10
Web 开发 81,107 成员 341,720 内容