struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Holloway" <>
Subject RE: Obtaining the ActionServlet context from a utility class
Date Mon, 02 Dec 2002 01:13:22 GMT
I'm embedding the attributes themselves in the struts-config file and
passing these to a custom struts plugin that I've created.  I then
embed these attributes in the servlet context on startup of the class
(i.e. in the init method).  

The thing is I have another factory class that needs access to the
context and that's the problem I have, getting hold of the action
before obtaining the servlet context to retrieve the attributes.

I sit possible just to embed the functionality of my factory class in my
plugin class and simply call the methods in the plugin class.  I didn't
think this was the right way hence the creation of a factory class and
a plugin class to do the job.

I don't want to use the utility in non Struts related classes either,
this is purely for my Struts action classes use.


-----Original Message-----
From: Brian DeLuca [] 
Sent: 01 December 2002 23:56
Subject: RE: Obtaining the ActionServlet context from a utility class


To use it in a utility class would mean you have to import the http
packages into your utility class -- not a good practice since other
projects, that are not web oriented may want to use them.

Why not just pass the attribute as a parameter to the method?

 --- On Sun 12/01, Jonathan Holloway  wrote:From:
Jonathan Holloway [mailto:]To:
struts-user@jakarta.apache.orgDate: Sun, 1 Dec 2002 19:47:20
-0000Subject: Obtaining the ActionServlet context from a utility
classDoes anybody know how to get hold of the action servlet from a
so to get an attribute from the servlet context?  I'm basically trying
to do
this from a utility class but don't know how to go about it.
 Jonathan Holloway,               
 Dept. Of Computer Science,       
 Aberystwyth University, 
 West Wales,                      
 SY23 3DV.                        
 07968 902140                  

Can a Web portal forever change your life?
Win up to $25 Million on iWon - click here!

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message