Since Struts tags can't be nested.  Nest Struts "dynamic" <bean:write>'s
inside plain HTML tags.

<input type="checkbox" name="prodActForm_<bean:write name="yourName"
property="yourProperty"/>">


I have successfully tackeled this problem from a few different angles...
Let me know if this helps, or not...

Michael Marrotte

-----Original Message-----
From: Jeremy Prellwitz [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 16, 2002 12:48 PM
To: [EMAIL PROTECTED]
Subject: Help!: Dynamic Property Name and JavaScript values


Does anyone know how to include dynamic values for the
name/value pairs inside struts tags?

e.g.

<html:checkbox onclick="monitorCheckBoxes(this.form,<%= i %
>,2)" name="prodActForm" property="property(<%= "c_" + i
= "_2")" />

I am trying to dynamically generate rows of checkboxes
similar to below:

 --   --
 | |  | |
 --   --

 --   --
 | |  | |
 --   --

 --   --
 | |  | |
 --   --

 --   --
 | |  | |
 --   --


I have a form bean with a setProperty(String, String) and a
getProperty(String).

I want to dynamically generate the names of the checkboxes so
that the end result is:

formBean.setProperty("c_0_1",<value>);
formBean.setProperty("c_0_2",<value>);
formBean.setProperty("c_1_1",<value>);
formBean.setProperty("c_1_2",<value>);
formBean.setProperty("c_2_1",<value>);
formBean.setProperty("c_2_2",<value>);
formBean.setProperty("c_3_1",<value>);
formBean.setProperty("c_3_2",<value>);

where <value> is the value of the checkbox from the form.  Of
course, it would only be called if the checkbox had a value.
But my problem is i can't get the HTML to display correctly.

This for example comes out as:

<html:checkbox onclick="monitorCheckBoxes(this.form,<%= i %
>,2)" name="prodActForm" property="property(xyx)" />


<input type="checkbox" name="property(xyz)" value="on"
onclick="monitorCheckBoxes(this.form,<%= i %>,2)">


As you can see it actuall prints the string: "<%= i %>"
versus the value of "i" that i want.

Can anyone help?



Thanks kindly!

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



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

Reply via email to