struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: Help finding the right code for dynamic forms
Date Wed, 12 Mar 2003 19:56:16 GMT
Not sure if this is what you're after, but the Digester rules that Struts uses
to parse its configuration are encapsulated in
org.apache.struts.config.ConfigRuleSet. The creation of the Digester itself
happens in ActionServlet.initConfigDigester. ActionServlet.initModuleConfig is
where the Digester is actually kicked off (which is called from
ActionServlet.init). Once the configuration is parsed, initModuleConfig will
look through all the FormBeanConfig instances and will invoke
DynaActionFormClass.createDynaActionFormClass for each DynaActionForm instance.
So, if you want to trace through it, the code trail is something like:

init
  initModuleConfig
    initConfigDigester
    DynaActionFormClass.createDynaActionFormClass

The bridge between DynaActionForm and JSTL is DynaActionForm's getMap method. It
allows you to use an expression like ${dynaForm.map.propName} or
${dynaForm.map["prop.name"]}.

Not sure what you mean by "The database behind the DAO layer is multivalued".
Since you're not using JDBC, is there another way to get metadata from the
database about the fields you're interested in? If so, you could probably put
together a PlugIn that dynamically builds a FormBeanConfig from
FormPropertyConfig instances that map to each of the fields. Once you have the
FormBeanConfig, the PlugIn can just invoke config.addFormBeanConfig and
DynaActionFormClass.createDynaActionFormClass. In theory at least...;-)

Quoting Wendy Smoak <Wendy.Smoak@asu.edu>:

> 
> 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.)
> 
> -- 
> Wendy Smoak
> Applications Systems Analyst, Sr.
> Arizona State University PA Information Resources Management
> 


-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
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