As far as I can see your code looks Ok.

>From the code of the tag, this exception is throw when the value object is
null.  
Can your sb.getCheckBoxName return null?

That is all I can think of.


-----Original Message-----
From: Mattos, John [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 12:48 PM
To: 'Struts Users Mailing List'
Subject: RE [2]: Form Question - Dynamic number of checkboxes - Multibox
?


Okay, so now I have the following:

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

         </TD>
      </TR> 
    </logic:iterate>

and I have an int[] field on my bean called "assetId"

and it's telling me 

"You must specify the value attribute or nested tag content"

I thought that's what I was doing when I specified
value="<%=sb.getCheckBoxName()%>" in the multiBox.

the getcheckboxName, by the way, returns the assetId, so I hope to end
upwith an array of these things in the bean

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

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 11:42 AM
To: [EMAIL PROTECTED]
Subject: RE: Form Question - Dynamic number of checkboxes


Look at the multibox tag.  Add an attribute to your form called product (I
think it has to be an a String array) and when you read.  It will populate
the array with the product selected.

David



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 11:32 AM
To: Struts Users Mailing List
Subject: Re: Form Question - Dynamic number of checkboxes




why don't you use indexed=true on the checkboxes and it will create indexed
names for them.  Have to use nightly build or new 1.1 beta.

Cheers,
Dave




"Mattos, John" <[EMAIL PROTECTED]> on 03/22/2002
11:13:16 AM

Please respond to "Struts Users Mailing List"
      <[EMAIL PROTECTED]>

To:   "'[EMAIL PROTECTED]'"
      <[EMAIL PROTECTED]>
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  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:
<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]>

--
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]>

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

Reply via email to