You should use the statement object instead of connection object to call the
method executeQuery
Statement stmt = connection.createStatement();
stmt.executeQuery(sql);
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Shun-Luoi Daniel Fong
Sent: Tuesday, April 17, 2001 2:49 PM
To: [EMAIL PROTECTED]
Subject: ResultSet not found
I'm using a JavaBean to communicate with a mysql database.
Here's what I do:
1. login.jsp -- user enters ID and password; also when this page is
loaded the ConnectionBean is declared with scope="session"
2. when the user hits "submit", the form sends the data to checklogin.jsp
where the submitted data is checked against the database.
I'm getting an error though at checklogin.jsp
***
Error: 500
Location: /gamezone/checklogin.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for
JSP/usr/java/jakarta-tomcat-3.2.1/work/localhost_8080%2Fgamezone/_0002fcheck
login_0002ejspchecklogin_jsp_0.java:91: Class
ResultSet not found.
ResultSet results = connection.executeQuery(sql);
^
1 error
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:254)
at
org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
at
org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:433)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:152)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:164)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConnection
(Ajp13ConnectionHandler.java:160)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
Here is the code I have in checklogin.jsp
*
jsp:directive.page import="java.sql.*,java.sql.ResultSet"
errorPage="error.jsp" /
jsp:useBean id="connection" class="ConnectionBean" scope="session" /
%
String p_ID = request.getParameter("player_id");
String p_passwd = request.getParameter("player_passwd");
connection.setAutoCommit(false);
String sql;
sql = "SELECT player_id, player_passwd FROM player WHERE player_id=" + p_ID
+ " AND player_passwd=" + p_passwd;
ResultSet results = connection.executeQuery(sql);
if( results.next() ) { %
% /* ID and password correct, forward to main page */ %
jsp:forward page="index.jsp" /
% } else { %
% /* ID and password incorrect, forward to login.jsp to reenter login
info */ %
jsp:forward page="login.jsp" /
% } %
**
Is there an obvious(or not so obvious) reason why the jsp can't find the
ResultSet class?
Thanks,
Luoi
btw. I'm using Tomcat 3.2.1/linux/apache
my jsp's are located in /home/httpd/html/gamezone rather than
$TOMCAT_HOME/webapps/
--
D. Shun-Luoi Fong
821 Melrose Avenue
Iowa City, IA 52246
email: [EMAIL PROTECTED]
---
Colossions 2:8 See to it that no one takes you captive through philosophy
or empty deception, according to the traditions of men, according to the
elementary principles of the world, rather than according to Christ.
---