On Tue, 9 Apr 2002, Heath Chiavettone wrote:
> Date: Tue, 9 Apr 2002 18:34:52 -0700
> From: Heath Chiavettone <[EMAIL PROTECTED]>
> Reply-To: Jakarta Commons Developers List <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: BeanUtils.populate() question
>
> I know that this package is mostly used by Struts but it is designed to be
> used generically. We are in the process of evolving to Struts, but it will
> take some time. So here is the scenario I'm thinking of using this in.
>
The original design of BeanUtils.populate() was to replace
<jsp:setProperty property="*"/>. It should do what you described below
(with the extra abilities to handle nested, indexed, and mapped property
names automatically as well).
Craig
>
>
> In our (Model 1) world, we have designed our JSPs to be mated to a JavaBean
> which is used to process all of the data for the form. We are using a
> custom tag to "initialize" these beans on in the JSP and then use the
> <jsp:setProperty name="*"/> mechanism in the JSP to "bind" the data to the
> bean. Recently, we have begun using a (Servlet 2.3) filter, to
> pre-processed the request and convert the String and String[] into the
> appropriate object types such Integer, BigDecimal, Long, and several other
> application-specific "primitive" types (using a custom mechanism) and stores
> them in the request as attributes (keyed to the parameter name). As a
> result, I can now create a Map that is keyed to the property name, but will
> contain the not only the basic String or String[] values for all "real"
> string properties, but also these other object types. Rather than using the
> setProperty * mechanism, I would like to modify the custom tag to use the
> BeanUtils package to improve our "binding" mechanism. In looking at the
> Javadoc (see below) for the populate method, I'm not to sure if what I want
> to do will work.
>
>
>
> I was wondering if the BeansUtil.populate() method could be used in the
> following manner:
>
>
>
> Parameters:
>
> bean - JavaBean whose properties are being populated
>
> properties - Map keyed by property name, with the corresponding (String or
> String[]) value(s) to be set
>
>
>
> So I guess I have couple of questions:
>
>
>
> 1. Can I use populate to accomplish my goal of binding the Map of the
> various property "Objects" to the appropriate bean properties?
> 2. If not, then will the PropertyUtils.set*() class of methods work?
> 3. If so, will I gain any of the Introspection performance gains that I
> believe BeanUtils.populate gives me?
>
>
>
> Thanks,
>
>
>
> Heath
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>