Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: [S2] ArrayList always NULL when posting data in a form

cisco

2007-03-06

Replies:


So how would you define the collection ?
Can you provide a snipet of code.

Thanks


Eider Iturbe-2 wrote:
>
> Hello,
>
> you can not define the ArrayList like you did it. You have to define like
> this:
>
>
> The collection to be iterated over MUST conform to one of the following
> requirements in order for iteration to be successful:
>
>   - An array of Java objects or primitives.
>   - An implementation of java.util.Collection, including ArrayList and
>   Vector.
>   - An implementation of java.util.Enumeration.
>   - An implementation of java.util.Iterator.
>   - An implementation of java.util.Map, including HashMap, Hashtable,
>   and TreeMap. *NOTE* - See below for additional information about
>   accessing Maps.
>
> So you have to define a Collection instead of an ArrayList. I hope this
> help
> you,
>
> Eider
>
>
> On 06/03/07, cisco <fjuarez@(protected):
>>
>>
>> Hello all.
>> I need some help.
>> I have a form which contains an ArrayList, this list has getters and
>> setters
>> :
>>
>> private ArrayList <DataProvRecDTO> entitylist = new
>> ArrayList<DataProvRecDTO>();
>> /**
>> * @return Returns the entitylist.
>> */
>> public ArrayList<DataProvRecDTO> getEntitylist()
>> {
>>     return entitylist;
>> }
>>
>> /**
>> * @param entitylist The entitylist to set.
>> */
>> public void setEntitylist(ArrayList<DataProvRecDTO> entitylist)
>> {
>>     this.entitylist = entitylist;
>> }
>>
>> I use this list on a JSP page :
>> <logic:iterate id="entity" indexId="ind" name="DataProvRecActionForm"
>> property ="entitylist"
>> type="com.hcfa.datamanager.datamodel.dto.DataProvRecDTO" >
>>
>> <td class="resultTd" nowrap><html:text maxlength="2" size="3"
>> name="entity" property="jun" /></td>
>>
>> The display of data works great. But when I make changes to the data and
>> submit the form, the array is always NULL.. Any help please..
>>
>> Cisco..
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/ArrayList-always-NULL-when-posting-data-in-a-form-tf3356167.html#a9334040
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.