各位大神求助 Unable to compile class for JSP:
报错:typeExceptionreportmesssageUnabletocompileclassforJSPdescriptionTheserverencounter...
报错:
type Exception report messsage Unable to compile class for JSP description The server encountered an internal error that prevented it from fulfilling
this request.
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 38 in the jsp file: /index.jsp
Syntax error on token "Exception", VariableDeclaratorId expected after this token
35: }
36: rs.close();
37: }
38: catch(Exception){
39: out.println(e.getMessage());
40: }
41: stmt.close();
An error occurred at line: 39 in the jsp file: /index.jsp
e cannot be resolved
36: rs.close();
37: }
38: catch(Exception){
39: out.println(e.getMessage());
40: }
41: stmt.close();
42: conn.close();
源代码:
<html>
<head><title>JDBC建立数据连接</title>
</head>
<body>
<center>
<font size=5 color=blue>数据查询</font><hr>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:bookshoplk","sa","sa");
Statement stmt=conn.createStatement();
try{
ResultSet rs;
rs=stmt.executeQuery("SELECT*FROM booktable where bookid='ISBN 7-04-012301-0'");
%>
<table border=3>
<tr bgcolor=silver><b>
<td>bookid</td><td>bookname</td><td>author</td><td>publisher</td><td>pubdate</td><td>price</td><td>type</td><td>quantity</td></b></tr>
<%
while(rs.next()){
%>
<tr>
<td><%=rs.getString("bookid")%></td>
<td><%=rs.getString("bookname")%></td>
<td><%=rs.getString("author")%></td>
<td><%=rs.getString("publisher")%></td>
<td><%=rs.getString("pubdate")%></td>
<td><%=rs.getString("price")%></td>
<td><%=rs.getString("type")%></td>
<td><%=rs.getString("quantity")%></td>
</tr>
<%
}
rs.close();
}
catch(Exception){
out.println(e.getMessage());
}
stmt.close();
conn.close();
%>
</table>
</center>
</body></html> 展开
type Exception report messsage Unable to compile class for JSP description The server encountered an internal error that prevented it from fulfilling
this request.
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 38 in the jsp file: /index.jsp
Syntax error on token "Exception", VariableDeclaratorId expected after this token
35: }
36: rs.close();
37: }
38: catch(Exception){
39: out.println(e.getMessage());
40: }
41: stmt.close();
An error occurred at line: 39 in the jsp file: /index.jsp
e cannot be resolved
36: rs.close();
37: }
38: catch(Exception){
39: out.println(e.getMessage());
40: }
41: stmt.close();
42: conn.close();
源代码:
<html>
<head><title>JDBC建立数据连接</title>
</head>
<body>
<center>
<font size=5 color=blue>数据查询</font><hr>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:bookshoplk","sa","sa");
Statement stmt=conn.createStatement();
try{
ResultSet rs;
rs=stmt.executeQuery("SELECT*FROM booktable where bookid='ISBN 7-04-012301-0'");
%>
<table border=3>
<tr bgcolor=silver><b>
<td>bookid</td><td>bookname</td><td>author</td><td>publisher</td><td>pubdate</td><td>price</td><td>type</td><td>quantity</td></b></tr>
<%
while(rs.next()){
%>
<tr>
<td><%=rs.getString("bookid")%></td>
<td><%=rs.getString("bookname")%></td>
<td><%=rs.getString("author")%></td>
<td><%=rs.getString("publisher")%></td>
<td><%=rs.getString("pubdate")%></td>
<td><%=rs.getString("price")%></td>
<td><%=rs.getString("type")%></td>
<td><%=rs.getString("quantity")%></td>
</tr>
<%
}
rs.close();
}
catch(Exception){
out.println(e.getMessage());
}
stmt.close();
conn.close();
%>
</table>
</center>
</body></html> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询