If however it might be the kind of values that you want to make sure are up-to-date, i.e., read from a database maybe...
Then one simple solution is create yourself a class that is basically independant from your application that is used for setup for a paricular screen or set of screens. Create a static method for the setup, then from any Action associated with a page that needs that data, just call that static method at the start of the Action. Simple, one line of code per Action and one import (or none, if it's in the same package).
I would create static members of the setup class for the attribute names, and make the static setup method(s) return something like an ArrayList (or whatever type you need), so that you can call it from your Actions with something like:
request.setAttribute(MySetupClass.MY_ATTRIBUTE_NAME, MySetupClass.doSetup());
That way you aren't tied to it being a webapp, should you need to do a different presentation layer later.
I think this is a decent, simple approach to this type of thing.
-- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com
Ben Taylor wrote:
Hi,
Can anyone tell me if there is an easy way to put information (required to populate drop down boxes using data from a db) in to the request, without having to write a setup Action for each page as is done here: http://www.reumann.net/struts/lesson2/step9.do .
Thank you for any help!
--------------------------------------------------------------------- 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]