Wendy Smoak wrote:
On 6/16/06, Scott Van Wart <[EMAIL PROTECTED]> wrote:
I'd like to define the structure of a DynaValidatorForm on the fly
instead of through struts-config.xml.  I had a look at FormBeanConfig
and DynaActionFormClass (which says "Application developers never need
to consult this documentation" :), but I'm not sure where to start.  I'd
like to do something like this:

<form-bean name="runtimeForm" type="mypkg.RuntimeForm" />

Do you really need to define the structure, or is it sufficient that
the form accepts whatever property you try to set on it?  I'm thinking
that one of the "lazy" varieties might work:

<form-bean name="runtimeForm"
type="org.apache.struts.validator.LazyValidatorForm" />

This will work best if the forms are fairly flat and simple.  If they
have nested objects, you might have to do more work.


OK, I'll give that a shot. Do lazy forms have the benefit of auto-population or do I need to copy the parameters from request to action form myself?

I think the most complex I'll get at the moment is a multibox; I'm almost positive all my properties are going to be String or String[], with no nested attributes.

In case you're curious, I have 8-9 entity classes defined in Hibernate, and they're all pretty much the same (same type primary key, some have a non-null foreign key, no big deal, a few many-to-one relationships, all have a "description" property, and one-to-many relationships which I won't worry about in the form). So I'd like to build a routine to create an action form structure based on the hibernate mappings, and I can use reflection to get/set properties.

UNLESS of course, someone's already done this and has a project, struts addon/plugin, or something else available, but if so, the experience of writing it myself would be useful :).

Thanks again,
 Scott


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to