I think this solution is "the bomb". I once suggested a generic solution like this for Struts called StrutsState. No one was much interested, so I just built it for my own work. It is so helpful that I cannot express my gratitude toward myself to myself. ///;-)
On Sat, 05 Mar 2005 14:27:08 -0500, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > Someone else made some good suggestions about listeners and plugins. > These will work well if the dropdown contents are truly static. > > 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] > > -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]