都
都当主席谁种地
Unregistered / Unconfirmed
GUEST, unregistred user!
我的odbc数据源名称是jsp,我在执行时有一个错误说:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /mycon.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:/Tomcat 5.0/work/Catalina/localhost/_/org/apache/jsp/mycon_jsp.java:62: not a statement
con.close;
^
1 error
程序清单如下:
<%@ 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){}
try {con=DriverManager.getConnection("jdbcdbc:jsp","sa",""
sql=con.createStatement();
rs=sql.executeQuery("select a from test"
out.print("<Table Border>"
out.print("<TR>"
out.print("<TH width=100>"+"a"
out.print("</TR>"
while (rs.next())
{out.print("<TR>"
out.print("<TD>"+rs.getString(1)+"</TD>"
out.print("</TR>"
}
out.print("</Table>"
con.close;
}
catch (SQLException e1){}
%>
</BODY>
</HTML>
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /mycon.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:/Tomcat 5.0/work/Catalina/localhost/_/org/apache/jsp/mycon_jsp.java:62: not a statement
con.close;
^
1 error
程序清单如下:
<%@ 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){}
try {con=DriverManager.getConnection("jdbcdbc:jsp","sa",""
sql=con.createStatement();
rs=sql.executeQuery("select a from test"
out.print("<Table Border>"
out.print("<TR>"
out.print("<TH width=100>"+"a"
out.print("</TR>"
while (rs.next())
{out.print("<TR>"
out.print("<TD>"+rs.getString(1)+"</TD>"
out.print("</TR>"
}
out.print("</Table>"
con.close;
}
catch (SQLException e1){}
%>
</BODY>
</HTML>