jsp汉字显示乱码

来源:百度知道 编辑:UC知道 时间:2024/05/12 08:55:48
<%@page contentType="text/html;charest=ISO-8859-1" import="java.utill.*"%>
<%@page language='java'%>
<html>
<head>
<title>Post</title>
</head>
<body>
<% request.setCharacterEncoding("gb2312");%>
<center><b>
<font size=5 color=blue>Request 对象的应用
<hr><br>
</font>
<p></p>
<font size=4 color=yellow>
<%= request.getParameter("txt")%><br>
请记住您的登录密码:
<br><br>
<font color=red>
<%= request.getParameter("pswd")%>
</font></font>
</b></center>
</body>
</html>
怎么办,汉字全是乱码
没用,我一开始就是GB2312

<% request.setCharacterEncoding("gb2312");%>
把这里面的改成GBK就可以了……你们都在乱讲,自己都没试验过

把上面这个CHARSET改成GB2312,
发现在你CHARSET都打错了。

<%@page contentType="text/html;charset=GB2312" import="java.utill.*"%>
<%@page language='java'%>
<html>
<head>
<title>Post</title>
</head>
<body>
<% request.setCharacterEncoding("gb2312");%>
<center><b>
<font size=5 color=blue>Request 对象的应用
<hr><br>
</font>
<p></p>
<font size=4 color=yellow>
<%= request.getParameter("txt")%><br>
请记住您的登录密码:
<br><br>
<font color=red>
<%= request.getParameter("pswd")%>
</font></font>
</b></center>
</body>
</html>

把这句改成
<%@page contentType="text/html;charest=gb2312" import="java.utill.*"%>