Hi,

Yeah will is right : stripes will set a null element in the list at
specified position. This is expected behavior.

You can also do it like will suggested, without indices, by repeating
the parameter :
foo.bar=1
foo.bar=3

This will bind a list like (1,3), assuming foo.bar is a prop of type
List of course...

Cheers

Remi



2010/10/23, Will Hartung <redro...@sbcglobal.net>:
>
> On Oct 22, 2010, at 1:39 PM, Nathan Maves wrote:
>
>> Give the following parameter
>>
>> foo[0].bar=abc
>> foo[1].bar=abc
>> foo[2].bar=
>> foo[3].bar=abc
>>
>> I would expect the Collection<Foo> in my action to have a size of 3.
>> Instead I get a size of 4 where one of the items in the collection is
>> null.
>>
>> Is this the correct behavior?
>
> Seems correct to me.
>
> First, if the parameter is actually being passed, Stripes will bind it. So
> if you are passing "foo[2].bar", then, yea it'll happily add that null to
> the list.
>
> However, also note that the indexes provided are absolute. And Stripes will
> honor that.
>
> For example, if you simply pass "foo[3].bar=abc" Stripes will create an
> ArrayList, and then do list.set(3, "abc"), which will extend the list to 4
> slots, the first 3 of which are null.
>
> Something that Stripes does NOT support, is simply appending to lists.
>
> Some frameworks (PHP?? Maybe??) support "foo[]=abc, foo[]=def" and just tack
> those on to an ever groing list.
>
> Stripes does not do that (as I recall).
>
> It might work with simply "foo.bar=abc, foo.bar=def". I've never done that,
> so I don't know what will happen. But that may work, and may be closer to
> what you want.
>
> Regards,
>
> Will Hartung
>
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>

-- 
Envoyé avec mon mobile

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to