第一次弄tomcat和jsp,为嘛打开在浏览器打开的乱码!!用的是tomcat6.0.35,求大神!
<!doctype html public"-//w3c//dtd html 4.0 transitional//en""http://www.w3.org/TR/REC-html40/strict.dtd">
<%@ page language="java" contentType="text/html,charset=gb2312" import="java.util.*,java.text.*"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=GBK">
<title> welcome Tomcat</title>
</head>
<body>
<br><br><center>欢迎使用 TOMCAT!<br><br>
<%
Date date=new Date();
SimpleDateFormat dateFm=new SimpleDateFormat("EEEE-MMMM-dd-yyyy");
%>
<%=dateFm.format(date)%>
</body>
</html>
<!doctype html public"-//w3c//dtd html 4.0 transitional//en""http://www.w3.org/TR/REC-html40/strict.dtd">
<%@ page language="java" contentType="text/html,charset=gb2312" import="java.util.*,java.text.*"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=GBK">
<title> welcome Tomcat</title>
</head>
<body>
<br><br><center>欢迎使用 TOMCAT!<br><br>
<%
Date date=new Date();
SimpleDateFormat dateFm=new SimpleDateFormat("EEEE-MMMM-dd-yyyy");
%>
<%=dateFm.format(date)%>
</body>
</html>
或者加pageEncoding="GBK"
这个地方写错了,应该为:
contentType="text/html;charset=gb2312"
是个分号,不是逗号