Well, I was using copyProperties...or rather I\'d want to. I\'m just trying to avoid having to declare my Transfer Objects the hard way.
Say I use Mark Lowe\'s idea of the Nested Form Bean (makes sense in alot of ways), but I want to do it dynamically. i.e. DynaForm A has a List property of what will be a bunch of DynaBean B\'s. So riddle me this, how do I instantiate a DynaBean myself as it is defined in the struts-config.xml? When it\'s passed in to the Action as the form, it\'s all prepped and ready to go. If I instantiate an instance of the class myself, it\'s got no dynaproperties. I know BeanUtils will provide functionality to do this, but I would hope there\'s an exposed method that does based straight out of the contents struts-config. Does Struts provide a method where I provide it the name of the bean defined in the struts-config.xml and it return me an instance of the appropriate class, with all the dyna properties set up? -Joe > -----Original Message----- > From: Hubert Rabago [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 25, 2004 8:38 AM > To: Struts Users Mailing List > Subject: Re: DynaForm Type Conversion > > > Take a look at BeanUtils.copyProperties. By default, though, > it doesn\'t support conversion of dates, since it wouldn\'t > know how you\'d want your dates formatted. Check the archives > of this list, there\'s been some discussion on that. Another > archive you can check is that of the commons-user list. > > If you\'re looking for further reduction in code, take a look > at http://www.rabago.net/struts/formdef which I\'m working on. > It\'s alpha, but an initial release is coming real soon (and > I\'m looking for folks to help me develop/maintain it). > > I believe the Struts dev team has plans to include > functionality like this in a future version of Struts. For > now, we either make do with BeanUtils, or do the conversion > ourselves, or through third party plugins like what I\'m > working on. If you feel strongly enough about it, you can > rant some more on > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27321 > though like I said, the dev team has plans for supporting > this functionality in a future version. How near or far into > the future might be influenced by user requests. :) > > > --- Joe Hertz <[EMAIL PROTECTED]> wrote: > > > > I have a bean I persist with Hibernate. It\'s properties are: > > > > 2 Floats > > 1 Integer (the key) > > 2 Dates > > > > Now, relying on my handy dandy copies of Struts KickStart, > Struts In > > Action, and all of the Web, I\'m apparently supposed to > declare these > > methods in the > > > > Form I am using as Strings since automatic type conversion > can fubar > > them. > > > > But Since the JSP I am using is getting these fields with html:text > > fields, I apparently am supposed to have methods in form to do the > > type conversion for > > me. Okay, that\'s light years better than putting this in > the business > > layer, > > but fine. > > > > Is there an Automatic way I can get a DynaBean to do this for me? > > Maybe a Get (prop, type) and get(prop, type, value) for the > types youd > > find in java.lang? > > > > If not, there should be, because it limits what a DynaBean > can do in a > > big > > kinda way. Why have a type declaration in the DTD if youre > only ever going > > to > > want to use String and String[] ? :-) > > > > I mean, it\'s not like I couldnt add such a set of methods to my > > DynaValidatorActionForm subclass, but what I\'d want is for > the framework to > > > > use them for me without me needing to know about it. (I > dont ask for > > much, do I???). > > > > If not, I\'d like to continue to use my Subclassed > > DynaValidatorActionForm > > anyway, but I am wondering if it is going to be > self-defeating to declare > > custom getters and setters for properties that are declared > in struts > > config? > > Should I just use it as a non-dyna form? > > > > Maybe I\'ve been up too late (okay, I have) but it\'s the > little things > > like > > this that makes me feel like Struts is creating work for me > rather than > > saving me from it. > > > > > > Tx for indulging my sleepy rant. > > -Joe > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]