Thanks for the responses guys. Does that mean the following getter (given at
http://jakarta.apache.org/struts/faqs/indexedprops.html) is incorrect? It
doesn't seem to follow the javabean spec for indexed properties:

public java.util.List getStringIndexed(int index) { 
        return java.util.Arrays.asList(strAry);
}

(If it's taking an index as a parameter, why would it return the whole list?
Is this some additional functionality that BeanUtils provides?)

Regarding the 2 variants for getters and setters - which one should I use?
Both? If I use the "whole list" variant, then I can't do any index checking
to prevent an indexing exception (unless I decide to subclass ArrayList and
override the set(index, object) method). But when I introduce the "indexed"
variant, I start getting bean-related JspExceptions like "JspException: No
getter method for property .." even though the property name matches up with
the getter and setter.

Thanks for your help!
sunil


> -----Original Message-----
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 23, 2004 11:13
> To: Struts Users Mailing List; John D. Hume
> Cc: Struts Users Mailing List
> Subject: Re: Conventions for indexed properties
> 
> 
> Quoting "John D. Hume" <[EMAIL PROTECTED]>:
> 
> > I don't have a definitive guide, but here are some examples 
> that could 
> > be helpful.
> > 
> 
> The definitive guide starts with the JavaBeans Specification:
> 
>   http://java.sun.com/products/javabeans/reference/api/index.html
> 
> you'll see that there are two variants for indexed properties 
> -- one that has
> the getter and setter methods taking an array, and one that 
> has the getter and
> setter methods taking an additional argument for the index.
> 
> There's lots of other useful info about what it means to be a 
> JavaBean here as
> well.  Just as one example, did you know that you can 
> actually use any method
> names you want (getFoo/setFoo is not required) if you're 
> willing to build a
> BeanInfo associated with your bean class?  Or that you can 
> "hide" properties
> from Struts (well, really from commons-beanutils) by creating 
> a BeanInfo that
> does not include them?
> 
> Craig
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to