初学的问题,执行jsp的时候什么也不显示,why?
为什么执行01.jsp的时候什么也不显示,就是一片空白。。
01.jsp:
<%@page contentType= "text/html;charset = GB2312 "%>
<%@page import= "java.sql.* "%>
<%
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
} catch (
ClassNotFoundException ce) {
out.println(ce.getMessage());
}
try {
conn = DriverManager.getConnection( "jdbc:odbc:grade ");
stmt = conn.createStatement();
rs = stmt.executeQuery( "select * from grade ");
while (rs.next()) {
out.println(rs.getString( "学号 "));
out.println(rs.getString( "姓名 "));
out.println(rs.getString( "语文 "));
out.println(rs.getString( "数学 "));
out.println(rs.getString( "英语 "));
out.println( " <br> ");
}
} catch (
SQLException e) {
System.out.println(e.getMessage());
} finally {
stmt.close();
conn.close();
}
%>
------解决方案--------------------会不会是编码的问题呢?
你把列名设置成英文看看。
------解决方案--------------------写了这么久程序,从没用中文字段!!!!!