Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 33443 invoked from network); 10 Apr 2002 03:01:10 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 10 Apr 2002 03:01:10 -0000 Received: (qmail 8220 invoked by uid 97); 10 Apr 2002 03:01:04 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 8088 invoked by uid 97); 10 Apr 2002 03:01:04 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 7925 invoked from network); 10 Apr 2002 03:01:02 -0000 Date: Tue, 9 Apr 2002 20:00:51 -0700 (PDT) From: "Craig R. McClanahan" To: Jakarta Commons Developers List Subject: Re: BeanUtils.populate() question In-Reply-To: <271DE2625FD4D311949B009027F43B9F0EF8DEB9@us-mtvmail2.ariba.com> Message-ID: <20020409195959.O65435-100000@icarus.apache.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: localhost 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Tue, 9 Apr 2002, Heath Chiavettone wrote: > Date: Tue, 9 Apr 2002 18:34:52 -0700 > From: Heath Chiavettone > Reply-To: Jakarta Commons Developers List > To: "'commons-dev@jakarta.apache.org'" > 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 . 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 > 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: For additional commands, e-mail: