Aladin Alaily wrote:
Doesn't putting all of the output data in the session or even in the request add even more clutter and confusion? When the data is nicely packaged in an object you can manipulate it more easily and you can keep track of where the information came from. Although using an ActionForm for this purpose might confuse some, I think that it is a better alternative than putting the data in the session or request scope.
Isn't that where ActionForms are? In any case, nobody said it couldn't be encapsulated in some nice, tidy object.
One project I saw had "output" data in ActionForms: hit a page, the ActionForm is loaded (for instance, with a list of headlines, etc.) by Struts then used on the page as an output object.
I was opposed, although it was nice that it was magickally instantiated and the logic was completely removed from the Action. However, everything was tied to Struts and I couldn't reuse functionality in non-Struts code.
I think whether or not ActionForms are input or output could be argued either way. Even the Struts page says:
*"Note:* While ActionForm beans often have properties that correspond to properties in your Model beans, the form beans themselves should be considered a Controller component. As such, they are able to transfer data between the Model and View layers."
That said, I've never (and most likely never will) put data into an ActionForm that isn't destined for an HTML form: I like the _concept_ of putting "output" in ActionForms but think that ActionForms are best reserved for HTML forms. Output data belongs elsewhere, preferably in a nice automagically-instantiated ActionForm analogue, decoupled from Struts.
Dave

