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> 展开
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> 展开
2个回答
展开全部
操作数据库的步骤:
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读取数据
}
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读取数据
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询