Learned something new, thank you. Unfortunately, the good news don't apply to my case, I don't need the length for iteration. I wish I was programming Groovy...
-a On 26 April 2010 15:07, Oscar Westra van Holthe - Kind < os...@westravanholthe.nl> wrote: > On 26-04-2010 at 14:59, Aaron Stromas wrote: > > My action bean has a String[] valued property with getter and setter, > say, > > x. The JSP is happy with using the array in <stripes:options-collection > > collection="x"/> but referring to ${actionBean.x.length} generates > > NumberFormatException. Does it make sense? Thanks, > > Sadly, yes: length is not a JavaBeans property (the method name is > length(), > not getLength()). Using a Collection won't help either, as the method name > is > then size() (not getSize()). > > But there is also good news: you rarely need the length on its own. > Usually, > the entire array is important: > - when building the page you can iterate the elements (and using the > attribute varStatus you can name a variable of the type > javax.servlet.jsp.jstl.core.LoopTagStatus which has a convenient > getIndex() > method) > - when parsing the resulting request parameters, Stripes will happily bind > to > an array or List. See here for more details: > http://www.stripesframework.org/display/stripes/Indexed+Properties > > > Oscar > > -- > ,-_ Oscar Westra van Holthe - Kind > http://www.xs4all.nl/~kindop/<http://www.xs4all.nl/%7Ekindop/> > /() ) > (__ ( The haves and the have-nots can often be traced back to the > =/ () dids and the did-nots. > > -----BEGIN PGP SIGNATURE----- > > iEYEARECAAYFAkvV5G8ACgkQLDKOJAl7tOJWwwCdHwWndXfZRze6C297o5GftDqv > 8poAoPXfQEnEBxo2UMaFITvYjE21E4r6 > =Kspm > -----END PGP SIGNATURE----- > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Stripes-users mailing list > Stripes-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/stripes-users > > -- Aaron Stromas
------------------------------------------------------------------------------
_______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users