struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert McIntosh <rob...@bull-enterprises.com>
Subject Re: Help finding the right code for dynamic forms
Date Wed, 12 Mar 2003 19:27:41 GMT
I've been using DynaBeans outside of Struts, and in short, there is no 
standard tool for reading the XML and generating the DynaClass/DynaBean, 
although you could look at the source code for struts and see how it is 
done (which uses the Digester). Or, you can create your own format and 
do it yourself. It isn't that hard really. Assuming you want to use the 
BasicDynaBean, the process I followed was basically:

- Create a DynaProperty for each property needed
- Create a DynaClass supplying the array of DynaProperties created above
- Use it :-)

However if you want JavaBean compliant objects, you can either create 
your own code generator, which I have done before using Velocity for the 
code templates, or use the BCEL library 
(http://jakarta.apache.org/bcel/), which can generate class files at 
runtime.

HTH,
Robert


Wendy Smoak wrote:

>I'm trying to make the back-end of my Struts webapp more flexible, and I'm
>interested in the mechanism by which a dynamic form is created.  I'm
>currently using the DAO pattern, so I have a ton of Data Transport Objects.
>I've just hit a file with 129 data fields and I'm just not excited about
>writing (or even using a code generator to produce) all those get/set
>methods.  Twice, because there will be an interface and an implementation.
>
>The database behind the DAO layer is multivalued.  I'm not using a JDBC
>driver, so none of the existing magic will work.
>
>The next version (UniData 6.0) is supposed to speak XML, so I think I could
>produce something like the <form-bean><form-property> structure from the
>data dictionary.
>
>Given that, some sort of XML file describing the data fields, what do I look
>at to transform that into a class that conforms to the JavaBeans spec?  It
>would need to work with JSTL as I often have a DTO sitting in the session
>that I use JSTL to display pieces of.
>
>I've looked around in the code but I've only found the actual DynaWhatever
>classes, not the bits that read the XML and create the objects.  Where is
>that hiding?  And if anyone could give a high level overview of what
>actually happens, that would help.
>
>Thanks!  (Not technically Struts related, I know... please reply privately.)
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message