Sue,

I had the same kinda situation you do and heres what I did:

1:> I have two beans- A LoginBean and a DBManagerBean( handles all database
related tasks incl. connections)
2:> I call the LoginBean from JSP and then from LoginBean I instantiate my
DBManagerBean and make a connection to the database
3:> Then I put the LoginBean in the session

        session.putValue("login",LoginBean);

4:> I which ever JSP page or bean I need the LoginBean reference, I just
call

        LoginBean _loginBean = (LoginBean) session.getValue("login");

5:> and then do something like this to get the DBManager Connection

        Connection conn = _loginBean.getDBManager().getDBConnection();

6:> Also I made my LoginBean implement HttpSessionBindingListener so if I
lose the session, I can do some cleanup stuff

In my case, the lifetime of both the beans were session, since I used my
backend security to do the user validation but  using a similar kind of
setup u can also use the Database connection pooling mechanisms, the only
difference is going to be that the DB Connection Pooling bean would have to
be of "application" scope

Hope u find is helpful...

Asim Imam
Java Developer
@AT&T Tax Systems Group
email: [EMAIL PROTECTED]

-----Original Message-----
From: Susan Holden [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 27, 1999 9:54 AM
To: [EMAIL PROTECTED]
Subject: Re: passing objects between beans.


 Hi,

 I have login page that sends login information from a form in a jsp to a
bean that
creates a connection to a database. I'm then trying to pass this connection
into
another bean that executes a query. Has anyone passed objects from one  bean
to
another?

Sue

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to