struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Richards <gru...@cyber4.org>
Subject Re: subclassing ActionServlet?
Date Fri, 25 May 2001 04:47:47 GMT

I made a sub-class of ActionServlet an overloaded the initXXX()
method that created the connecion pool. I did this because
my database manager beans needed access to the connection
pool parameters.

The other choice is to use something like a singleton or factory
bean pattery that generates the objects (or returns an instance
to an already created one) as you need it. The down side is
it may not have the initialisation parameters it needs.

iwanek@nttdata.co.jp wrote:
> 
> Hello struts-users,
> 
> My webapp needs bunch of beans that should be available
> all the time and accessible from all JSP pages, so I guess I
> have to create the beans at the startup time and set them to
> the application context.
> 
> How should I do this? My candidates are,
> 
> 1) create a subclass of ActionServlet and do it there,
> 2) create a subclass of Servlet (unrelated to ActionServlet)
>     and do it there.
> 
> Which is better, or are there any other standard ways?
> I don't see any examples that use subclasses of ActionServlet,
> and I am wondering if there are some reasons not to.
> 
> Thanks in advance,
> 
> - kazumi

Mime
View raw message