So many ways.....

One way:
Have your connection manager class implement the Singleton design pattern. If your not 
familiar with this design pattern, this means that there will only be one instance of 
the class per JVM per class loader. You'll have a public getInstance() method that 
will return a reference to the connection manager - you'll call this method from your 
JSP.

Another way is to place the Connection manager in the ServletContext as an attribute. 
You may want to set the attribute at the setup of the application server (use 
<load-on-startup>1</load-on-startup> in the <servlet> element of web.xml).........
All of your JSP will do something like:

ConnectionManager c = 
(ConnectionManager)application.getAttribute("com.yoursite.ConnectionManager");

That's all I can think of now.

Rick Reumann wrote:

> I apologize if this is too basic a question for this list. If so you feel free to 
>flame me.
>
> First off, if the design issues are bad here to start with please tell me.
> Anyway say I have a connection pool ( ConnectionManater.java ). Then I also have 
>several different classes that have methods that do DB stuff and they get their 
>connections from this pool. Now I have JSPs for the front end that call these methods.
>
> The question I have is there a "best" way to load up the ConnectionManager for the 
>application? I was just going to use a <jsp:useBean ..> tag on every jsp page with 
>the ConnectionManager having application. Is there a better way to do it so that all 
>of the methods called from the classes have access to the connection pool?  Since 
>before any user can use the application they will have to go to a login page I was 
>thinking maybe there is something I can do just once on the login page that will set 
>up the ConnectionManager and I then wouldn't need to have to include the useBean tag 
>on the top of every other page. Maybe I'm doing it the best way, but I'd like some 
>suggestions if there are other ways.
> Thanks so much,
> Rick
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> 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

--
Erik I Morton
Software Developer
------------------
CommerceHub
http://www.commercehub.com
518-886-0704
21 Corporate Drive
Clifton Park, NY 12065

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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

Reply via email to