在jsp程序中设置:
<%@ page contentType="text/html; charset=ISO8859_1" %>同时设置页面的<meta/>如下:
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<%@ page contentType="text/html; charset=ISO8859_1" %>同时设置页面的<meta/>如下:
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
和
<%@ page contentType="text/html; charset=ISO8859_1" %>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
的区别是什么?
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">这是在html文件嵌套在<head></head>标签中你可以这样写你的jsp程序:test.jsp<%@ page contentType="text/html; charset=ISO8859_1" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
</head><body>
i love you!<br>
我爱你<br>
<%
out.println("我也爱你!");
%>
</body></html>
试试看,肯定不会有乱码!
编译后--> a_jsp.java
----------------------------
上面的话有些不懂哦这是JBuilder生成的JSP页面编码设置
<%@ page contentType="text/html; charset=GBK" %>
楼主不妨参考参考
另:<meta http-equiv="Content-Type" content="text/html;charset=gb2312">是html文件中对简体中文的编码设置
相当于在IE的菜单:查看>>编码>>中文编码(GB2312)
而且例子中的话那么肉麻,还是要给分!