Link to home
Start Free TrialLog in
Avatar of java_world
java_world

asked on

Model 2 Architecture of JSP

In Model2 Architecture of JSP,
We are using Servlets,JSP's and Beans.
In this, Beans are connecting to Other
Resources.
That means, in Beans only , we have to
do the Database Transactions.
Then what about the connection pooling.
Will Bean takes care of Connection Pooling.
Where as in Servlets, Connection pooling will be taken care by Server.
Even, we can write the Connection once
in the init() method Servlet Cycle and
use it in the whole Servlet Program.

So, I would like to know about where to take care of the database Transactions
whether to be in Servlets or in Beans or in JSP's.
ASKER CERTIFIED SOLUTION
Avatar of msmolyak
msmolyak

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sjhyam
sjhyam

Dear Friend!
  It is also possible to maintain a Connection Pooling using a bean. But,imagine what happens if we created more than one object for that bean. Then multiple connections will be opened, which in turn increase the traffic. So ,it is better to maintain Connection pooling in Servlet init() method. In JSP Model 2 Architecture Servlet is said to be controller--which decides about which bean to instantiate to process the clinet request. So, obviously it the controller's duty to maintain a connection to the resources--at least in this case, which needs multiple connections to a data base.

bye
shyam sunder reddy