commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [BeanUtils] failure when a bean extends HashMap
Date Thu, 16 Jan 2003 06:28:26 GMT


On Wed, 15 Jan 2003, Daniel Kehoe wrote:

> Date: Wed, 15 Jan 2003 21:31:16 -0800
> From: Daniel Kehoe <kehoe@fortuity.com>
> Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> To: commons-user@jakarta.apache.org
> Subject: [BeanUtils] failure when a bean extends HashMap
>
> I'm using the Java Server Faces early access release, which uses
> beanutils v1.3.
>
> JSF uses beanutils to set properties in a Model bean (for example, a User
> object in the HTTPSession).
>
> I have a bean that extends HashMap (e.g. "public class User extends
> HashMap").
>
> Things work fine with beanutils v1.3 but when I swap in beanutils v1.4 or
> 1.5, the behavior changes. No errors are thrown but there are no calls to
> my bean's get/set methods and its state doesn't change.
>
> This can be easily reproduced by taking the JSF "helloDuke" example,
> updating commons-beanutils.jar to 1.5, and changing
> "public class UserNameBean" to "public class UserNameBean extends
> HashMap".
>
> Is this the intended behavior? Why the change from beanutils v1.3? Is it
> not a good practice to extend a bean from a collection class?

I suspect that the issue might be related to corrections to the code in
MethodUtils that recognizes the actual methods, which will be affected by
situations where you subclass things.

In any event, the use of commons-beanutils for resolving model reference
expressions was a temporary expedient in the first public EA release of
JavaServer Faces.  The next EA release will be using code based on the
expression language (EL) evaluator in JSTL 1.0.  In the mean time, the
first public EA release of JSF is rev-locked to use the commons-beanutils
version that it shipped with.

> --
>   Daniel

Craig McClanahan
(Co-Spec lead for JSR-127, JavaServer Faces)


Mime
View raw message