tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <mdigg...@latte.harvard.edu>
Subject Designing Good Objects for EL
Date Tue, 03 Sep 2002 18:40:49 GMT
Ugh,

I've been plagued with issues that have to do with EL and accessing 
Attributes/Properties in Objects. It turns out that the following is a 
very big issue:

1.) Objects that extend or implment java.util.Collection api will always 
revert to that api when you try to access them using EL.

for example:
    if an object extends HashMap and has both the method 'get(Object o)' 
and the method 'getFooBar()' EL will try to use the 'get("fooBar")' 
method for 'object.fooBar' and not call getFooBar() so Collection 
objects can only be Collection objects and JavaBeans can only be 
JavaBeans. They cannot be mixed.

2.) JavaBeans specs limit what an Object can contain in terms of 
methods. I always disliked that they haven't made JavaBeans any 
"smarter" than "get/set" I'm always wanting to do things like 
"add/remove". Really!, whats the use of the Collections API if I'm 
always stuck converting Collections to Object[]'s just to spit them in 
and out through the JavaBean Api.

This is tough in JSTL

    if I want to call a non-bean method I have to get my own reference 
to the object and use that <% 
((ObjectCast)pageContext.getAttribute("fooBar")).method(); %>

Finally,

Does EL have capabilities for "Indexed" JavaBean patterns? I can't find 
any online documentation on this?

-Mark




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


Mime
View raw message