RE: Application scope objects

2001-09-13 Thread MacKellar, Kimberly

I created a servlet that is loaded at server initialization by including the
following in web.xml

  
Initialization
com.tfp.fraudban.InitializationServlet
1
  

and in the init method of InitializationServlet I make a call like

getServletContext().setAttribute("returnTypes", list);

which saves an ArrayList list into the attribute returnTypes in the
servlet's context.  list is being populated by some calls to the database.

Kim
-Original Message-
From: Debasish Ghosh [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 13, 2001 4:24 PM
To: [EMAIL PROTECTED]
Subject: Application scope objects


Hi All -

In my application, I would like to cache some of the
objects at the application scope in order to reduce
database access. What is the most recommended way of
achieving this in Struts ? Should I make them members
of OurActionServlet, which is derived from
ActionServlet ?

Please suggest.

Regards.

- Debasish

__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/



RE: Application scope objects

2001-09-20 Thread Craig R. McClanahan

The technique that Kimerly describes works well in many environments.  In
a Servlet2.3 environment (such as Tomcat 4), you also have the option to
use an application event listener that is notified when the application is
started, and when it is being shut down.  For more information, see the
Servlet 2.3 specification at:

  http://java.sun.com/products/servlet/download.html

Craig McClanahan


On Thu, 13 Sep 2001, MacKellar, Kimberly wrote:

> Date: Thu, 13 Sep 2001 16:38:12 -0500
> From: "MacKellar, Kimberly" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: RE: Application scope objects
>
> I created a servlet that is loaded at server initialization by including the
> following in web.xml
>
>   
> Initialization
> com.tfp.fraudban.InitializationServlet
> 1
>   
>
> and in the init method of InitializationServlet I make a call like
>
> getServletContext().setAttribute("returnTypes", list);
>
> which saves an ArrayList list into the attribute returnTypes in the
> servlet's context.  list is being populated by some calls to the database.
>
> Kim
> -Original Message-
> From: Debasish Ghosh [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 13, 2001 4:24 PM
> To: [EMAIL PROTECTED]
> Subject: Application scope objects
>
>
> Hi All -
>
> In my application, I would like to cache some of the
> objects at the application scope in order to reduce
> database access. What is the most recommended way of
> achieving this in Struts ? Should I make them members
> of OurActionServlet, which is derived from
> ActionServlet ?
>
> Please suggest.
>
> Regards.
>
> - Debasish
>
> __
> Terrorist Attacks on U.S. - How can you help?
> Donate cash, emergency relief information
> http://dailynews.yahoo.com/fc/US/Emergency_Information/
>




RE: Application scope objects

2001-09-24 Thread Debasish Ghosh

I am using Tomcat 3.2.2, but planning to migrate to
4.0. Then we will be implementing your suggestion.
Thanks for that.
Currently, we can use Kimerly's suggestion. But what
are the advantages of this option vrs. making the
attributes static members of a class derived from the
ActionServlet ? In this case we can have accessor
methods to get the attributes. 

Thanks for the help.

- Debasish

--- "Craig R. McClanahan" <[EMAIL PROTECTED]> wrote:
> The technique that Kimerly describes works well in
> many environments.  In
> a Servlet2.3 environment (such as Tomcat 4), you
> also have the option to
> use an application event listener that is notified
> when the application is
> started, and when it is being shut down.  For more
> information, see the
> Servlet 2.3 specification at:
> 
>   http://java.sun.com/products/servlet/download.html
> 
> Craig McClanahan
> 
> 
> On Thu, 13 Sep 2001, MacKellar, Kimberly wrote:
> 
> > Date: Thu, 13 Sep 2001 16:38:12 -0500
> > From: "MacKellar, Kimberly"
> <[EMAIL PROTECTED]>
> > Reply-To: [EMAIL PROTECTED]
> > To: "'[EMAIL PROTECTED]'"
> <[EMAIL PROTECTED]>
> > Subject: RE: Application scope objects
> >
> > I created a servlet that is loaded at server
> initialization by including the
> > following in web.xml
> >
> >   
> > Initialization
> >
>
com.tfp.fraudban.InitializationServlet
> > 1
> >   
> >
> > and in the init method of InitializationServlet I
> make a call like
> >
> > getServletContext().setAttribute("returnTypes",
> list);
> >
> > which saves an ArrayList list into the attribute
> returnTypes in the
> > servlet's context.  list is being populated by
> some calls to the database.
> >
> > Kim
> > -Original Message-
> > From: Debasish Ghosh
> [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 13, 2001 4:24 PM
> > To: [EMAIL PROTECTED]
> > Subject: Application scope objects
> >
> >
> > Hi All -
> >
> > In my application, I would like to cache some of
> the
> > objects at the application scope in order to
> reduce
> > database access. What is the most recommended way
> of
> > achieving this in Struts ? Should I make them
> members
> > of OurActionServlet, which is derived from
> > ActionServlet ?
> >
> > Please suggest.
> >
> > Regards.
> >
> > - Debasish
> >
> > __
> > Terrorist Attacks on U.S. - How can you help?
> > Donate cash, emergency relief information
> >
>
http://dailynews.yahoo.com/fc/US/Emergency_Information/
> >
> 


__
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. 
http://im.yahoo.com