On Sat, 05 Mar 2005 17:56:40 -0500, Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:

> Then again, I know *someone* is going to point out that Shale (or I
> guess JSF generically?) already has this notion ingrained in it.

But of course!  :-)

In Shale, a ViewController bean (pretty much the equivalent of
ActionForm+Action) has callback methods that the framework calls for
you:
- init() -- called if this page is going to either process a postback
  or be rendered
- preprocess() - called if we are about to process a postback
  (form submit) for the corresponding page
- prerender() - called if we are about to be rendered
- destroy() - called if init() was ever called

To the original question about getting rid of the setup action, the
Shale approach is to put that kind of setup stuff (populating dropdown
list options, etc.) in the prerender() method, which will be called
*only* if we are the page that is going to be rendered -- thus
avoiding needless work if you navigated somewhere else instead.

For Struts 1.x, the "setup method" or "setup helper class" idea seems
reasonable, unless you are using Tiles.  In that case, use a Tiles
Controller, which is almost the same thing as the Shale prerender()
method -- it is called just before that tile is rendered, and is
(again) the right place for this sort of setup behavior.

Craig

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

Reply via email to