struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil.Axtell" <>
Subject Dynamic Forms & FormBeans
Date Thu, 18 Jul 2002 15:27:08 GMT

Hello Struts-World.

Here's a Struts Newbie query I've got.

I really like being able to associate a FormBean with a Struts form and then
doing the validation etc. at the server end. I understand about having to
have attributes in the FormBean that match the names of the input elements
in the HTML form.

However, I cannot think of a way of creating a FormBean that can cope with a
form that has entirely dynamically generated output. For example, one that
creates a list of items in a shopping cart where every item has an
associated "delete" checkbox. I can ensure that each checkbox has a similar
name, (I'm using the name to indicate the cart item to which it relates
rather than the value at the moment) but how can I map these to attributes
in the Form bean? At design-time I will not know how many attributes I need
to supply, or what their full names will be. If I use the same name for each
checkbox (i.e. all map to the same FormBean attribute) and hold the cart
item ID in the value how will I be able to store the different values?

I'm sure that there's a good "Struts way" to do this but I cannot see one at
the moment. Can anyone out there enlighten me?

Many thanks.


P.S. I'm currently using Struts 1.0.1 and would prefer to stay that way
until I get the current iteration of the project out of the way.


Neil Axtell
Principal Engineer (MMI/Web Technologies)
European Measurement Division - Engineering
200 Capability Green
Luton, UK
Tel:  +44 (0) 1582 433347
Fax: +44 (0) 1582 433276
E-Mail: <>

This email message, together with any attachments, is for the exclusive and
confidential use of the addressee(s).  If you have received this message in
error, please notify the sender by email immediately, then delete the
message and any copies.  Any views or opinions presented herein are solely
those of the author and do not necessarily represent those of the Anritsu
group of companies.

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

View raw message