Return-Path: Delivered-To: apmail-jakarta-struts-user-archive@jakarta.apache.org Received: (qmail 6793 invoked by uid 500); 25 May 2001 04:51:31 -0000 Mailing-List: contact struts-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: struts-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list struts-user@jakarta.apache.org Received: (qmail 6785 invoked from network); 25 May 2001 04:51:30 -0000 Received: from mta05.mail.au.uu.net (HELO mta05.mail.mel.aone.net.au) (203.2.192.85) by h31.sny.collab.net with SMTP; 25 May 2001 04:51:30 -0000 Received: from cyber4.org ([203.102.249.59]) by mta05.mail.mel.aone.net.au with ESMTP id <20010525045127.DXVU10022.mta05.mail.mel.aone.net.au@cyber4.org> for ; Fri, 25 May 2001 14:51:27 +1000 Message-ID: <3B0DE3F3.82393812@cyber4.org> Date: Fri, 25 May 2001 14:47:47 +1000 From: Jim Richards Organization: CyberCyberCyberCyber Pty Ltd X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: struts-user@jakarta.apache.org Subject: Re: subclassing ActionServlet? References: <3ED8076B8DBED311B10D00A0C9E307DA05D7994F@noanet03.noanet.nttdata.co.jp> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N 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