struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Günther Wieser <gwie...@creative-it.com>
Subject AW: Need Help Passing Data Values To My subclass Action class
Date Tue, 01 Mar 2005 16:23:30 GMT
use request.getSession().getServletContext() in the action class to receive
the context of the struts action servlet, and you can use the action class
to set a property of the action form as you would do it if you want to
prepopulate form data (a good example is described in
http://www.javaworld.com/javaworld/jw-09-2004/jw-0913-struts-p3.html using
two action classes, one for prepopulating the action form and one for the
actual "doing").
also you could implement a class that gets initialized during loading of a
webapp (e.g. implementing ServletContextListener ) and gets all data from
servlet context into a hashmap, and have a static method that retrieves the
data from this hash map.

kr,
guenther

-----Ursprüngliche Nachricht-----
Von: Scott Purcell [mailto:spurcell@vertisinc.com] 
Gesendet: Dienstag, 01. März 2005 17:09
An: user@struts.apache.org
Betreff: Need Help Passing Data Values To My subclass Action class

I am trying to pass a value that is configured in my web.xml which is my
"databaseID" that I need in my Action class.
 
I have asked prior, but received no help, so I am trying again. If I have a
value in the deployment file that I can get out using a ServletContext, how
can I get that into a subclass of an Action class, or even to a ActionForm
subclass, since neither extend the HttpServlet class?
 
I would appreciate any input,
Sincerely
Scott
 
 
 



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


Mime
View raw message