struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Holloway" <j...@aber.ac.uk>
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
servlet
context and that's the problem I have, getting hold of the action
servlet
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.

Jon.

-----Original Message-----
From: Brian DeLuca [mailto:bdeluca1@iwon.com] 
Sent: 01 December 2002 23:56
To: struts-user@jakarta.apache.org
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  jph8@aber.ac.uk  wrote:From:
Jonathan Holloway [mailto: jph8@aber.ac.uk]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
utility
class
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.
 
Jon.
 
*---------------------------------------------*
 Jonathan Holloway,               
 Dept. Of Computer Science,       
 Aberystwyth University, 
 Ceredigion,                      
 West Wales,                      
 SY23 3DV.                        
                                  
 07968 902140                     
 http://users.aber.ac.uk/jph8     
*---------------------------------------------*
 


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


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message