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/
  /() )
 (__ (  The haves and the have-nots can often be traced back to the
=/  ()  dids and the did-nots.

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to