jsp中文问题 现是我在test.jsp中<%out.println("你好!")%>这出在IE中不是显示"你好!"而是乱码。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%@ page language = "java" %>去掉你试试 <%@ page contentType="text/html;charset=gb2312" %><%out.println("你好!");%>我的显示正常 重起了。还是不行。<%@ page contentType="text/html;charset=gb2312" %><html><head><title>新建网页 1</title></head><body><% out.println("你好!");%></body></html>我就写了这一点代码。出来的就是乱码。我找不出原因呀。 在<head></head>里面加上这个<meta http-equiv="Content-Type" content="text/html; charset=gb2312">这个试试 开头加一句<%@page contentType="text/html;charset=GBK"%>就OK了 一般的jsp编码规范都建议在没个jsp页面开始的地方加上以下代码:<%@ page contentType="text/html; charset=GBK" %><%response.setHeader("Pragma","No-cache");//HTTP 1.1 禁止缓存response.setHeader("Cache-Control","no-cache");//HTTP 1.0禁止缓存response.setHeader("Expires","0");//防止被proxyrequest.setCharacterEncoding("GB2312");//设置编码%>其中request.setCharacterEncoding("GB2312");//设置编码就是用来设置编码的。你试一下下面的例子:<%@ page contentType="text/html; charset=GBK" %><%response.setHeader("Pragma","No-cache");//HTTP 1.1 禁止缓存response.setHeader("Cache-Control","no-cache");//HTTP 1.0禁止缓存response.setHeader("Expires","0");//防止被proxyrequest.setCharacterEncoding("GB2312");//设置编码%><html><head><title>新建网页 1</title></head><body><% out.println("你好!");%></body></html> <%response.setHeader("Pragma","No-cache");//HTTP 1.1 禁止缓存response.setHeader("Cache-Control","no-cache");//HTTP 1.0禁止缓存response.setHeader("Expires","0");//防止被proxyrequest.setCharacterEncoding("GB2312");//设置编码%>不能执行。Unable to compile class for JSP 是asp的代码呀。 正则表达式查询,麻烦大神路过帮一下 spring 上传文件 类型转换异常 extjs前台点击删除超链接后怎么重新加载grid列表!急 fileupload文件上传 Myeclipse和lomboz的区别? 怎么赚分 java 如何判断公交上下行状态 帮我看一个简单的jsp页面,如何取得记录集的记录数 Jsp中怎样读取客户端的文本文件?急!!!!! 有关#号入库的问题? servlet转发请求问题(100分,在线等待,解决后立即付账) sql问题,请格外高手帮忙解决,(急,再现等候)
去掉你试试
<%out.println("你好!");%>我的显示正常
<%@ page contentType="text/html;charset=gb2312" %>
<html><head>
<title>新建网页 1</title>
</head><body>
<%
out.println("你好!");
%>
</body></html>
我就写了这一点代码。出来的就是乱码。我找不出原因呀。
<%@page contentType="text/html;charset=GBK"%>
就OK了
<%
response.setHeader("Pragma","No-cache");//HTTP 1.1 禁止缓存
response.setHeader("Cache-Control","no-cache");//HTTP 1.0禁止缓存
response.setHeader("Expires","0");//防止被proxy
request.setCharacterEncoding("GB2312");//设置编码
%>
其中request.setCharacterEncoding("GB2312");//设置编码
就是用来设置编码的。
你试一下下面的例子:<%@ page contentType="text/html; charset=GBK" %>
<%
response.setHeader("Pragma","No-cache");//HTTP 1.1 禁止缓存
response.setHeader("Cache-Control","no-cache");//HTTP 1.0禁止缓存
response.setHeader("Expires","0");//防止被proxy
request.setCharacterEncoding("GB2312");//设置编码
%>
<html><head>
<title>新建网页 1</title>
</head><body>
<%
out.println("你好!");
%>
</body></html>
response.setHeader("Pragma","No-cache");//HTTP 1.1 禁止缓存
response.setHeader("Cache-Control","no-cache");//HTTP 1.0禁止缓存
response.setHeader("Expires","0");//防止被proxy
request.setCharacterEncoding("GB2312");//设置编码
%>
不能执行。Unable to compile class for JSP
是asp的代码呀。