There are a couple of different ways to go

* Subclass the ActionServlet and do the same thing you did before. Just 
cast the servlet object of the Actions to your subclass and call 
whatever you've added.
* Load a helper servlet that exposes itself or an object in application 
scope to return whatever global parameters or other business services 
you need.
* [Struts 1.1] Use a plugin Action to do the same thing.
* Use the generic property parameter to the actions that need the String.
* Use an ActionMapping subclass and provide your own parameter string to 
each mapping.

In any case, a good way to go is to load any String parameters from a 
Properties file. Your servlet or plugin Action can then just load the 
Properties and everyone else can get what they need from there.

There some code for loading Propertoes file in the ResourcesUtil class here:

http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/

-T.

Smith, Johnathan M. wrote:

> In the pass I setup InitParameter's in my web.xml file for my control
> (servlet) and the control pass the string on to each model.  How can I do
> the same thing in Struts. I need to pass a string like a database name to
> every action object.  I would like it in a files so if I go from dev to QA
> to prod I only have to change the name in a file
> 
> 
> Johnathan Mark Smith
> Divisional Assistant Vice President
> Information Systems Division
> 
> Phone: (201) 352-1387
> Pager: (201) 718-1370
> Email: [EMAIL PROTECTED]
> Text Messaging: [EMAIL PROTECTED]
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 


-- 
Ted Husted, Husted dot Com, Fairport NY US
co-author, Java Web Development with Struts
Order it today:
<http://husted.com/struts/book.html>


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

Reply via email to