Hi Ancat

like this:
<s:iterator value="itinerary.cities" status="city">
<s:textfield name="itinerary.cities[%{#city.index}]" value="[0]"
</s:iterator>

Struts should take care of populating the array when you submit the form to
the action.

On Sat, Apr 12, 2008 at 8:26 PM, ancatdubher <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> My action looks like this:
>
> class TravellerAction extends ActionSupport{
>    private Plan itinerary;
>    // More..
> }
>
> The class "Plan" is a travel plan for a user and contains an ArrayList of
> cities you wanna visit:
>
> class Plan {
>   private ArrayList cities;
>   // More..
> }
>
> Now, when a user is entering data on a JSP, he should be able to enter the
> names of upto 10 cities he wants to visit. Upon submit, the JSP calls the
> TravellerAction.
>
> I managed to display the cities by doing this:
>
>    <s:iterator value="itinerary.cities">
>        <s:property/>&nbsp;
>    </s:iterator>
>
> How do I populate the cities from the JSP, back into the Action? (ie. with
> 10 text fields)
>
> Thanks,
> Ancat
> --
> View this message in context:
> http://www.nabble.com/STruts-2---populating-an-ArrayList-from-the-JSP-tp16653470p16653470.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to