主题:一个菜鸟的烦恼
我按照书上一步一步作的 但还是不幸的出问题了!
代码如下:
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<HTML>
<BODY>
<%
Connection con;
Statement sql;
ResultSet rs;
try
{
class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
out.print("类找不到!")
}
try
{
con=DriverManager.gerConnection("jdbc:odbc:host");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * FROM guests");
out.print("<Table Border>");
out.print("<TR><td colspan=8 align=center>客户数据</td></tr>");
out.print("<TR>");
out.print("<td width=50>"+"姓名");
out.print("<td width=50>"+"现住房间号");
out.print("<td width=50>"+"性别");
out.print("<td width=50>"+"证件类别");
out.print("<td width=50>"+"证件号");
out.print("<td width=50>"+"国家编号");
out.print("<td width=50>"+"到达日期");
out.print("<td width=50>"+"离开日期");
out.print("<td width=50>"+"押金");
out.print("</TR>");
while(rs.next())
{
out.print("<TR>");
out.print("<TD>"+rs.getString("name"));
out.print("<TD>"+rs.getString("roomcode"));
out.print("<TD>"+rs.getString("sex"));
out.print("<TD>"+rs.getString("certclassno"));
out.print("<TD>"+rs.getString("certificate"));
out.print("<TD>"+rs.getString("countryno"));
out.print("<TD>"+rs.getString("arridate"));
out.print("<TD>"+rs.getString("leftdate"));
out.print("<TD>"+rs.getString("price"));
out.print("</TR>");
}
out.print("</table>");
con.close();
}
catch(SQLException e1)
{
out.print("SQL 异常!")
}
%>
</body>
</html>
错误提示如下:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "class", invalid Expression
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error, insert ";" to complete BlockStatements
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", invalid AssignmentOperator
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", ; expected
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", invalid AssignmentOperator
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", ; expected
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", invalid AssignmentOperator
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", ; expected
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", invalid AssignmentOperator
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", ; expected
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", invalid AssignmentOperator
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error, insert ";" to complete BlockStatements
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.12 logs.
信心被沉重打击啊!!!
大家帮帮这个可怜的菜鸟把!
代码如下:
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<HTML>
<BODY>
<%
Connection con;
Statement sql;
ResultSet rs;
try
{
class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
out.print("类找不到!")
}
try
{
con=DriverManager.gerConnection("jdbc:odbc:host");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * FROM guests");
out.print("<Table Border>");
out.print("<TR><td colspan=8 align=center>客户数据</td></tr>");
out.print("<TR>");
out.print("<td width=50>"+"姓名");
out.print("<td width=50>"+"现住房间号");
out.print("<td width=50>"+"性别");
out.print("<td width=50>"+"证件类别");
out.print("<td width=50>"+"证件号");
out.print("<td width=50>"+"国家编号");
out.print("<td width=50>"+"到达日期");
out.print("<td width=50>"+"离开日期");
out.print("<td width=50>"+"押金");
out.print("</TR>");
while(rs.next())
{
out.print("<TR>");
out.print("<TD>"+rs.getString("name"));
out.print("<TD>"+rs.getString("roomcode"));
out.print("<TD>"+rs.getString("sex"));
out.print("<TD>"+rs.getString("certclassno"));
out.print("<TD>"+rs.getString("certificate"));
out.print("<TD>"+rs.getString("countryno"));
out.print("<TD>"+rs.getString("arridate"));
out.print("<TD>"+rs.getString("leftdate"));
out.print("<TD>"+rs.getString("price"));
out.print("</TR>");
}
out.print("</table>");
con.close();
}
catch(SQLException e1)
{
out.print("SQL 异常!")
}
%>
</body>
</html>
错误提示如下:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "class", invalid Expression
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error, insert ";" to complete BlockStatements
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", invalid AssignmentOperator
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", ; expected
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", invalid AssignmentOperator
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", ; expected
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", invalid AssignmentOperator
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", ; expected
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", invalid AssignmentOperator
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", ; expected
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error on token "Invalid Character", invalid AssignmentOperator
An error occurred at line: 5 in the jsp file: /selectGustesTable.jsp
Generated servlet error:
Syntax error, insert ";" to complete BlockStatements
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.12 logs.
信心被沉重打击啊!!!
大家帮帮这个可怜的菜鸟把!