struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Rosenberg <>
Subject Re: [POLL] What do you use action forms for?
Date Thu, 12 May 2005 15:59:20 GMT

On Thu, 2005-05-12 at 17:07 +0200, Pedro Salgado wrote:
> So you mean, on your actionform you use:
> The html form attributes + (this is what I understand for input)
> The collections needed to present combo/list boxes (and other options) (this
> is what I understand for output)
> I don't think #2 is this one. This is #4.

Maybe we should define exactly what input and output is.

Example: you have objects Book and Author. Each Book has a field author,
which links to an Author object (Id, Name, FirstName, etc).
Let us give the Book two properties, so its not that empty: Title and

Now you have a Book editing dialog, in this dialog you will have 

title and isbn rendered as input fields.
and author rendered as select, with appropriate authorsCollection,
filled with all available authors.

So the Class BookForm has 4 attributes: 
String title, isbn, author;
Collection authorsCollection;

All 4 attributes are solely needed for input (as for now at least) and
therefore the form is used as #2 scenario. 

On another page, which has nothing to do with the edit dialog you
present a book previously searched by some criteria.

If you are using scenario #4 you will reuse the BookForm here. The
problem with this approach is, that you don't need the half of BookForm
properties, what you need instead is:
with String name, title, authorDescription:
authorDescription is a field describing the Author object like:
author.getLastName()+", "+author.getFirstName() (or whatever your html
demands) and is typically filled by the Action.

As you see, you don't need the BookForm to present a Book, since you
need other properties for presentation, as for editing.
So if you are working with scenario #4 and reusing BookForm here, you
are actually _misusing_ the BookForm. Further, it's a bad design
approach, because, if you need to change the search result page and add
or remove some properties (a book rating by other users etc), you are
changing the edit dialog too, without actually knowing it (or exlicitely
search, aehm, where do i use this form?).

That's why I think, that scenario #4 is actually a bad choice, because
it creates dependencies, which are very hard to manage (especially after
some months).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message