I am doing something similar.
Our forms are 100% dynamic.  The contents on them is not know in advance to
write all the setters and getters.  The form is generated based on the user
and some database values.

I am using <logic:iterate> to create the forms.  If you iterate on a Map you
can pass a key (name) and value (contents of text box).  I am experimenting
with passing a bean down to offer more flexibility.

On the submit site, my .validate() method then manually parses the request
object back into the Map.  The Action class then manipulates the Map.

HTH,
Robert


-----Original Message-----
From: Shashi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 13, 2001 7:48
To: [EMAIL PROTECTED]
Subject: how to deal with Variable form elements in struts


Hi,

I have a form that looks very similar to the "inbox" in Yahoo or HotMail.

The number of checkbox is varying and so are their names. How to assign
their values to the Form Bean property?

Currently I've been using a normal "input" html form tag like follows.

<input type="checkbox" name="chk_<%= I %>">

and in the Action Class I'm using the request object to go through all the
form elements using getParameterNames and finding out the checkboxes and
getting the "checked" row.

Can some one through light on how to go about doing the same using the
Struts frame work.

--Shashi.


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

Reply via email to