You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Mattos, John" <jm...@Indemand.com> on 2002/03/22 17:13:16 UTC

Form Question - Dynamic number of checkboxes

Hi there all

I'm generating a form that can have dynamic checkboxes depending on
information retrieved from my database. I basically retrieve a bunch or rows
and for each one, I want to create a checkbox.

Than, in the Action class handling the form submission, I plan to loop
through the checkboxes, and build an array of those that were selected, and
do something to them.

The problem is that I am tying to name the checkboxes for the ID of the
row... here is a JSP snippet:

    <logic:iterate id="sb"
	type="com.indemand.indab.application.invoice.SuspendsTransaction"
	collection="<%=collectionName%>">
      <TR>
        <TD><%=sb.getProductName()%>&nbsp;</TD>
	 <TD><html:checkbox property="<%=sb.getCheckBoxName()%>" /></TD>
      </TR> 
    </logic:iterate>

<!-- end of snippet -->

the getCheckBoxName() comes from the database, and it correcponds to the
"Product" in this row, and it's dynamic.

Struts complains with the following error message....

	No getter method for property 4363 of bean
org.apache.struts.taglib.html.BEAN 
	
Essentially, I'm trying to create the following
<input type="checkbox" name="4363"> and struts can't find get4363() in the
bean. No surprise there, I can't create getters for all the possibilities. I
just planned to loop through the submitted form fields to get the ids
checked.

Is there any way that Struts can not care that the setters don't exist?

Does this make sense?


John Mattos
Sr. Developer and Architect
iNDEMAND
345 Hudson St. 16th Floor
New York, New York
10014


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>