Unable to compile class for JSP:谁能告诉我什么问题啊,在线等!急啊!!!!

org.apache.jasper.JasperException:UnabletocompileclassforJSP:Anerroroccurredatline:21... org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 21 in the jsp file: /login.jsp
rs cannot be resolved
18: if(aa!=null&&aa.equals("login")){
19: String s_userid=request.getParameter("userid");
20: String s_password=request.getParameter("password");
21: rs=stmt.executeQuery("select * from userinfo where userid='"+s_userid+"' and password='"+s_password+"'");
22: if(rs.next()){
23: session.setAttribute("userid",s_userid);
24: response.sendRedirect("index.jsp");

An error occurred at line: 21 in the jsp file: /login.jsp
stmt cannot be resolved
18: if(aa!=null&&aa.equals("login")){
19: String s_userid=request.getParameter("userid");
20: String s_password=request.getParameter("password");
21: rs=stmt.executeQuery("select * from userinfo where userid='"+s_userid+"' and password='"+s_password+"'");
22: if(rs.next()){
23: session.setAttribute("userid",s_userid);
24: response.sendRedirect("index.jsp");

An error occurred at line: 22 in the jsp file: /login.jsp
rs cannot be resolved
19: String s_userid=request.getParameter("userid");
20: String s_password=request.getParameter("password");
21: rs=stmt.executeQuery("select * from userinfo where userid='"+s_userid+"' and password='"+s_password+"'");
22: if(rs.next()){
23: session.setAttribute("userid",s_userid);
24: response.sendRedirect("index.jsp");
25: }

An error occurred at line: 49 in the jsp file: /shoppingcart.jsp
cbean.productid cannot be resolved or is not a field
46: d_totalamount+=cbean.subtotal;
47: %>
48: <tr>
49: <td height="19"><a href="bookdetail.jsp?productid=<%=cbean.productid%>" target="_blank"><%=cbean.productid%></a></td>
50: <td><%=cbean.productname%></td>
51: <td><%=cbean.publish%></td>
52: <td>¥<%=cbean.unitprice%></td>
An error occurred at line: 49 in the jsp file: /shoppingcart.jsp
cbean.productid cannot be resolved or is not a field
46: d_totalamount+=cbean.subtotal;
47: %>
48: <tr>
49: <td height="19"><a href="bookdetail.jsp?productid=<%=cbean.productid%>" target="_blank"><%=cbean.productid%></a></td>
50: <td><%=cbean.productname%></td>
51: <td><%=cbean.publish%></td>
52: <td>¥<%=cbean.unitprice%></td>

An error occurred at line: 50 in the jsp file: /shoppingcart.jsp
cbean.productname cannot be resolved or is not a field
47: %>
48: <tr>
49: <td height="19"><a href="bookdetail.jsp?productid=<%=cbean.productid%>" target="_blank"><%=cbean.productid%></a></td>
50: <td><%=cbean.productname%></td>
51: <td><%=cbean.publish%></td>
52: <td>¥<%=cbean.unitprice%></td>
53: <td><input type="text" class="formtext" value="<%=cbean.ordernum%>" size="5" readonly> 
展开
 我来答
yananzx2011
2011-06-07
知道答主
回答量:6
采纳率:0%
帮助的人:0
展开全部
操作数据库的步骤:
public class TestMain {
private static final String DRIVERNAME="com.microsoft.sqlserver.jdbc.SQLServerDriver";
private static final String URL="jdbc:sqlserver://localhost:1433;DatabaseName=test1";
private static final String USERNAME="sa";
private static final String PASSWORD="123@qwe";
public static Connection getCon(){
Connection conn=null;
try {
Class.forName(DRIVERNAME);
conn=DriverManager.getConnection(URL, USERNAME, PASSWORD);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return conn;
}
public static void main(String[] args){
Connection conn=getCon();
PreparedStatement ps=conn.prepareStatement(sql);//写你的sql语句
ResultSet rs=ps.executeQuery();
//用rs读取数据
}
oolgloo
2011-06-04 · TA获得超过2636个赞
知道小有建树答主
回答量:604
采纳率:0%
帮助的人:655万
展开全部
rs类型是什么!你不说编译器怎么知道!
加上:
ResultSet rs = ...
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式