hi all,
i try to use a connection bean in my jsp.
<%@page language="java" import="java.sql.*, jsp.*"%>
<jsp:useBean id="beanConnect" class="jsp.DbBean" scope="session"/>
but it gives this error, can anyone tell me what does this error message
imply?
Error: 500
Location: /test/jsp/profile.jsp
Internal Servlet Error:
javax.servlet.ServletException: jsp.DbBean
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:386)
at
jsp._0002fjsp_0002fprofile_0002ejspprofile_jsp_6._jspService(_0002fjsp_0002fprofile_0002ejspprofile_jsp_6.java:186)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasp
below is the sample bean:
package jsp;
import java.sql.*;
import java.io.*;
public class DbBean {
String dbURL =
"jdbc:oracle:thin:@ip:port:sid";
String dbDriver =
"oracle.jdbc.driver.OracleDriver";
private Connection dbCon;
public DbBean () {
super ();
}
public boolean connect () throws
ClassNotFoundException, SQLException {
Class.forName (this.getDbDriver ());
dbCon = DriverManager.getConnection
(this.getDbURL (), "scott", "tiger");
return true;
}
public void close () throws SQLException {
dbCon.close ();
}
public ResultSet execSQL (String
queryString) throws SQLException {
Statement stmt = dbCon.createStatement ();
ResultSet rs = stmt.executeQuery
(queryString);
return (rs == null) ? null : rs;
}
public String getDbDriver () {
return this.dbDriver;
}
public String setDbDriver (String newValue)
{
return this.dbDriver = newValue;
}
public String getDbURL () {
return this.dbURL;
}
public String setDbURL (String newValue) {
return this.dbURL = newValue;
}
} //end of the Dbbean
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets