Geeta,
Do you really think this would be better than doing it in a servlet context
listener?  If your container doesn't support that, wouldn't you still prefer
to write a plugin?  Or a class that uses the class loader to make sure the
data only gets loaded once?  Or a startup class (if you don't mind being
tied to your container)  I would think you'd want anything but to extend the
ActionServlet at this point.....
John



> -----Original Message-----
> From: Geeta Ramani [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 20, 2003 2:22 PM
> To: Struts Users Mailing List
> Subject: Re: Universally Accessable Object
>
>
> Larry:
>
> An easy way to do this would be to:
>
> 1. Write a controller class which extends the Struts ActionServlet.
> 2. Declare a *static* object of type (say) Hashtable in this controller.
> 3. In the init() method of the controller, write code to
> initialise this hashtable.
> 4. Finally make the appropriate markings in your web.xml so that
> your controller (rather than the Struts' ActionServlet) is what
> is called with a url-pattern of *.do and make sure the controller
> has a load-on-startup param as 1.
> 5. In your Action classes, you can then access this object in the
> normal way: MyController.myHashtable.
>
> Hth!
> Regards,
> Geeta
>
> Larry Hytail wrote:
>
> > I have a table of information contained in a backend database.
> The table is not very big and never will be.  I would like to
> create an object that holds the values from this table.  I would
> like this object to instantiate when the struts webapp is
> started.  Then I would like to be able to access this object from
> any Action object within my struts application.  Questions:
> >
> > 1) Where is the best place to put the instantiation of this object?
> >
> > 2) How do I get a handle on the object from the Action object?
> >
> > Larry Hytail
> >
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! Tax Center - forms, calculators, tips, and more
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to