tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam" <...@magicminds.com>
Subject Re: bean accessing bean
Date Tue, 27 Mar 2001 09:06:21 GMT
In the connection bean i have information specific for the current user. the
bean therefore resides in the session-scope.
So what's the code to grab the bean from the container?



----- Original Message -----
From: "Kris Gonzalez" <jimjamjoh@softhome.net>
To: <tomcat-user@jakarta.apache.org>
Sent: Tuesday, March 27, 2001 10:48 AM
Subject: Re: bean accessing bean


> Then why not import your connection bean directly into the beans' .java
files
> and instantiate your connection bean in the constructor for all of the
other
> beans which will use it?
>
> Sam wrote:
>
> > I'm not trying to access a bean in jsp, i'm trying to access a bean from
> > another bean directly, without jsp as an intermediate.
> > I don't want to pass that connection allong to all the classes (quite a
> > tree), because not all the classes have to use the connection, just the
once
> > at the bottom of the tree.
> >
> > ----- Original Message -----
> > From: "Kris Gonzalez" <jimjamjoh@softhome.net>
> > To: <tomcat-user@jakarta.apache.org>
> > Sent: Tuesday, March 27, 2001 10:31 AM
> > Subject: Re: bean accessing bean
> >
> > > Sam...
> > >
> > > I do the same thing, and accomplish this in JSP by importing the bean
> > > class via:
> > >
> > > <%@ page import="ConnectionBean" %>
> > >
> > > and instantiate the bean with
> > >
> > > <jsp:useBean id="conn" class="ConnectionBean" scope="request" />
> > >
> > > and using it via
> > >
> > > <%    conn.getConnection();   %>
> > >
> > > or some like sequence...
> > >
> > > Sam wrote:
> > >
> > > > Hi, I'm using Tomcat and have several Beans, who all require a
> > > > database connection.I've defined a connectionBean (which ofcourse
> > > > handles the database connection via connectionPooling). I want to be
> > > > able to call this connectionBean in every other bean.Can someone
tell
> > > > me how to do that? Sam.
> > >
>


Mime
View raw message