日期:2014-05-18  浏览次数:20722 次

some characters cannot be mapped using "ISO-8859-1"
我用Eclipse写jsp保存的时候它提示无法完成保存,因为上面的原因。我的代码如下:
<%@   page   info= "database   handler "   %>
<%@   page   import= "java.io.* "   %>
<%@   page   import= "java.util.* "   %>
<%@   page   import= "java.sql.* "   %>
<%@   page   import= "javax.servlet.* "   %>
<%@   page   import= "javax.servlet.http.* "   %>
<%@   page   contentType= "text/html;charser=gb2321 "   %>
<%
//声明
java.sql.Connection   sqlConn;//数据库连接对象
java.sql.Statement   sqlStmt;//语句对象
java.sql.ResultSet   sqlRst;//结果对象集
//登记JDBC驱动程序
Class.forName( "org.gjt.mm.mysql.Driver ").newInstance();
//连接数据库
sqlConn
java.sql.DriverManager.getConnection( "jdbc:mysql://localhost/stinfor ",
"aaa ", "aaa ");
//创建语句对象
sqlStmt
sqlConn.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,
java.sql.ResultSet.CONCUR_READ_ONLY);
//执行SQL语句
sqlRst=sqlStmt.executeQuery( "SELECT   NAME,NO   from   student ");
%>
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> JSP连接MYSQL测试 </title>
</head>
<body>
<table   border= "1 "   cellspacing= "0 "   cellpadding= "0 "   align= "center ">
<tr>
<th> 姓名 </th>
<th> 年龄 </th>
</tr>
<%while(sqlRst.next())   {%>
<tr>
<td> <%=sqlRst.getString(1)%> </td>
<td> <%=sqlRst.getLong(2)%> </td>
</tr>
<%}%>
</body>
</html>
<%
//关闭结果对象集
sqlRst.close();
//关闭语句对象
sqlStmt.close();
//关闭数据库连接
sqlConn.close();
%>

这个与mysql和tomcat有关系吗?
新来的,给分比较少
谢谢大家了!!

------解决方案--------------------
lz将: <%@ page contentType= "text/html;charser=gb2321 " %>
替换为: <%@ page contentType= "text/html;charset=gb2312 " language= "java "%>