Greetings all...

I'm trying to find out if there are any known best practices when it comes
to collections within form objects?

- First, if a collection of "stuff" (i.e. Either objects that contain
multiple values, or collections of single values such as strings) needs to
be displayed on a page (For example, a series dropdown options), does it
really belong in the form object, or should it go in the session
(particularly if its a collection of things that doesn't change too much)?

Code-wise, it seems quite clean to me to put a collection of objects in the
session, then to use something like this to display the contents of the
collection on the page:

<html:options collection="MyCollection"
                  property="name"
                  labelProperty="label"/>

- If collections really do belong in the form object, do you need two (one
for the values, and one for the labels)? This seems to be a bit cumbersome,
but seems to be necessary given html:option's potential attribute
combinations (i.e. If you specify a name and property attribute, the
html:option tag uses the name as the name of the bean in some scope, and the
property as the property on that bean that returns a collection. Ditto for
the labels - using the labelName and labelProperty attributes. This seems to
indicate that there need to be two collections on the form object: One for
the values and one for the labels, and that these collections should contain
"single values" (such as strings) and not objects that may have value and
label attributes within them. Again, this seems a bit cumbersome... Am I
just going about it the wrong way?).

Any feedback would be greatly appreciated...

Cheers...

Dave Bruzzone

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

Reply via email to