Hi,
We have
01. Data access class ( bean ) to connect to database, execute query and return recordset.
02. Class ( bean ) which prepares the dynamic SQL statement based on business logic. This class calls Data access class methods to connect to database, prepare statement and execute.
To improve the performance we would like to add database connection pool in Data access class (bean). Since Servlet�s INIT menthod is the best palce to create connection pool we are planning to make Data access class
servlet instead of bean.
My question is can we run the servlet from class ( bean ) mentioned in #2. For
testing purpose I tried the following code but it�s not working.
import javax.servlet.*;
import javax.servlet.http.*;
class Servlet1 extends HttpServlet {
String message;
public void init(ServletConfig config) throws ServletException {
message = "Done";
}
public void displayMessage () {
System.out.println(message);
}
}
public class ServletTest {
public static void main(String args[]) {
Servlet1 S = new Servlet1();
S.displayMessage();
}
}
Thanks
Dilip