In (very) short, I believe it essentially checks the type in this order:

1. Collection
2. Bean

If it finds it is a Collection type, it won't introspect the object for
bean properties.

The workaround is to make your class not extend ArrayList, and include
the ArrayList as a bean property.

> -----Original Message-----
> From: James Cook [mailto:jimcook@;visualxs.com]
> Sent: Monday, November 11, 2002 9:46 AM
> To: 'Tag Libraries Users List'
> Subject: Custom property in a Collection subclass
> 
> 
> I have a subclass of ArrayList that exposes its own property,
> userObject.
> 
> class NamedList extends ArrayList {
> 
>       Object _userObject;
> 
>       public NamedList(Object userObject) {
>               _userObject = userObject;
>       }
>       public Object getUserObject() {
>               return _userObject;
>       }
> 
>       public void setUserObject(Object userObject) {
>               _userObject = userObject;
>       }
> }
> 
> When I attempt to access the userObject using JSTL (Apache impl), I
> receive the following error:
> 
> JSTL
> ====
> <c:out value="${date.userObject}" />
> 
> Error
> =====
> An error occurred while evaluating custom action attribute 
> "value" with
> value "${date.userObject}": The "." operator was supplied 
> with an index
> value of type "java.lang.String" to be applied to a List or array, but
> that value cannot be converted to an integer.
> 
> It seems like the JSTL implementation is treating this call 
> like I meant
> ${date[userObject}, but surely there is a means to access 
> properties on
> a collection class?
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:taglibs-user-help@;jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org>

Reply via email to