You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by J P <jp...@hotmail.com> on 2002/05/28 21:08:06 UTC

accessing Javabeans properties on a List-implementing object from the EL

Hello,
Is it possible using the current JSTL default expression language to access 
Javabeans properties on an object deriving from List?

For example

public class MyObject implements List {

   ... definition of list methods ...

   public String getName();

}

if I had an instance of this class myObject normally I would reference its 
name value in an EL expression as "${myObject.name}"
However it appears that since the Class is a list, the EL is trying to 
coerce 'name' into an integer to do a lookup with get() which is failing.  
Is there a way to indicate to the EL evaluator that it should be explicitly 
going after the JavaBean property rather than trying to look it up in the 
List?  (Unfortunately, I cannot change the design of the MyObject class.)

Thanks
Jason Purcell
jpurcell001@hotmail.com






_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: accessing Javabeans properties on a List-implementing object from the EL

Posted by Shawn Bayern <ba...@essentially.net>.
On Tue, 28 May 2002, J P wrote:

> Is it possible using the current JSTL default expression language

Just to make sure it's clear, there is only one JSTL Expression
Language.  In the past, we provided a few for experimentation, with one
being the default.  In JSTL 1.0, there is a single expression language and
no option of pluggability.  Books and other materials that suggest this
are incorrect or out of date.

> to access Javabeans properties on an object deriving from List?
> 
> For example
> 
> public class MyObject implements List {
> 
>    ... definition of list methods ...
> 
>    public String getName();
> 
> }

No, the object's nature as a List occludes its JavaBean properties.  You
can wrap the object in another object that has a getList() method along
with other accessors that retrieve the object's properties directly.

-- 
Shawn Bayern
"JSP Standard Tag Library"   http://www.jstlbook.com
(coming in July 2002 from Manning Publications)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>