Where can I find an example of good architecture for a high database traffic JSP application using connection pooling?

Ryan Breidenbach

Accessing connection pools should really be outside the realm of a JSP. If a good architecture is what you are looking for, you should defer display responsibilities to your JSPs and let other classes handle retrieving data.

For example, let's says you have a JSP that has a FORM where a user can type in the name of an movie director. When they click "Submit", they should see a page listing all the movies that the director they selected directed.

A sound implementation of this would be to have the JSP containing the FORM submit to a servlet. The servlet would, in turn, handle all the data retrieval. This includes possibly obtaining a database connection from a pool, determining what class(es) to use to retreive the data, and populating the response/session object with this data (in this case - movie titles). Finally, the servlet would redirect the response to a JSP responsible for displaying these movie titles.

This design is basically the Model 2 architecture in a nutshell. In this architecture, JSPs are delegated to view responsibilites, while servlets and other classes act as the model/controller. You can find a more detailed description of the Model 2 architecture here.

As far as implementing a database connection pool, that is really out of the scope of this FAQ. However, you may find this FAQ answer helpful.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact