我在jsp中调用javabean连接数据库,老是出错!!请各位大侠帮帮忙!!
下面是我写的代码:jsp的代码:省略~~~~<formname="form1"method="post"action=""><inputname="select2"id=...
下面是我写的代码:
jsp的代码:
省略~~~~
<form name="form1" method="post" action="">
<input name="select2" id="select2" type="hidden" value="">
<h3 align="center"><strong>计划变更历史报告</strong> </h3>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="49%"><font size="2"> <div align="center">项目名称:
<select name="select1" onChange="OnChange()" tabindex="1">
<option name="itemname" value="">-相关项目-</option>
<jsp:useBean id= "jdbc" class= "jdbc.JDBCBean" scope= "page"/>
<%String itemname="";%>
<%try{
String sql="select distinct(item_name) from item_member where item_staff='"+User+"'";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
itemname=rs.getString("item_name");
%>
<option name="itemname" value="<%=itemname%>"><%=itemname%></option>
<%
}
}catch(Exception e){out.print(e.getMessage());}
%>
<%rs.close();%>
~~~~~~~~~
出错的地方:
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: 61 in the jsp file: /WebRoot/task/history_report.jsp
Generated servlet error:
stmt cannot be resolved
An error occurred at line: 72 in the jsp file: /WebRoot/task/history_report.jsp
Generated servlet error:
rs cannot be resolved 展开
jsp的代码:
省略~~~~
<form name="form1" method="post" action="">
<input name="select2" id="select2" type="hidden" value="">
<h3 align="center"><strong>计划变更历史报告</strong> </h3>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="49%"><font size="2"> <div align="center">项目名称:
<select name="select1" onChange="OnChange()" tabindex="1">
<option name="itemname" value="">-相关项目-</option>
<jsp:useBean id= "jdbc" class= "jdbc.JDBCBean" scope= "page"/>
<%String itemname="";%>
<%try{
String sql="select distinct(item_name) from item_member where item_staff='"+User+"'";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
itemname=rs.getString("item_name");
%>
<option name="itemname" value="<%=itemname%>"><%=itemname%></option>
<%
}
}catch(Exception e){out.print(e.getMessage());}
%>
<%rs.close();%>
~~~~~~~~~
出错的地方:
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: 61 in the jsp file: /WebRoot/task/history_report.jsp
Generated servlet error:
stmt cannot be resolved
An error occurred at line: 72 in the jsp file: /WebRoot/task/history_report.jsp
Generated servlet error:
rs cannot be resolved 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询