You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Domen, Ken" <Ke...@nike.com> on 2002/03/07 01:25:31 UTC

getting a list in Action class

If my jsp has the following:

<logic:iterate name="materialConfirmationForm" property="substances"
id="substanceBean">
<tr>
    <td class="table2"><html:text name="substanceBean" property="casNumber"
styleClass="input1"/></td>
	<td class="table2"><html:text name="substanceBean"
property="substanceName" styleClass="input1"/></td>
</tr>
</logic:iterate>

Why won't my receiving Action class get these elements with:

ArrayList list = myForm.getSubstances();
Iterator i = list.iterator();
while (i.hasNext())
{
        Substance s = (Substance)i.next();
        System.out.println("s.getCasNumber(): " + s.getCasNumber());
}


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


Re: getting a list in Action class

Posted by keithBacon <ke...@yahoo.com>.
tricky!
does
   myForm.getSubstances();
return a list? is it the correct size?
I would have thought putting enough debug messages would highlight the problem.
I'd guess it's not even executing your debug code because you'd get a null
pointer exception from list.iterator() if the list was missing & CalssCastExp
if you got the wrong list. 
Intriguing! (Most likely something really obvious... bit I can't see it.)
Keith.


--- "Domen, Ken" <Ke...@nike.com> wrote:
> If my jsp has the following:
> 
> <logic:iterate name="xxxForm" property="substances" id="substanceBean">
> <tr><td <html:text name="substanceBean" property="casNumber" /></td>
>     <td <html:text name="substanceBean" property="substanceName"</td>
> </tr>
> </logic:iterate>
> 
> Why won't my receiving Action class get these elements with:
> 
> ArrayList list = myForm.getSubstances();
> Iterator i = list.iterator();
> while (i.hasNext()) {
>         Substance s = (Substance)i.next();
>         System.out.println("s.getCasNumber(): " + s.getCasNumber());
> }


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keith Bacon - Looking for struts work - South-East UK.
phone UK 07960 011275

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

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