The gotcha is that a DTO usually has typed fields, and can't redisplay invalid data. An ActionForm is specifically designed to capture String input, validate it, then redisplay it if necessary, so it can then be converted to whatever type is desired. Most DTO's aren't up for this type of gauntlet.

What I would like to do is merge (2) and (3), and add additional properties so that an input form can be fully described. Right now, we have form details spread across the sturts-config, validations.xml, and the server page. A central element that could render most of the form for you (including i18n labels, hints, and so forth), would eliminate a lot of the redundancy we face today.

I'd also like to include bi-directional data-converters in the form element, to close the loop. So, after validating the input, we could extract a populated DTO from a factory-type method. Likewise, we could pass a DTO to the form object and have it convert the binary types to properly-formatted Strings.

Right now, I'm working on this using FormProc and Maverick (SourceForge projects) and hope to move it to Struts soon.

-Ted.

Hubert Rabago wrote:
I think we're tackling different issues here.
What I'm trying to avaoid is having (1) a data transfer object used by the
different tiers, and (2) a form bean object or dyna form bean definition which is
a close reflection of the fields that the DTO already defines, and (3) a
validation rule xml which lists down all/most of the fields along with rules on
how to validate each.
Of course, I'll also need to write code to convert my DTO to a form bean and vice
versa.
I'm thinking we can lose the explicit form bean definition and the code which
converts between the DTO and form bean.


--- Mete Kural <[EMAIL PROTECTED]> wrote:


For a given form/action, the framework will be supplied with the FQCN of the
DTO/VO. From there, it can determine what the fields of the form will be.

The


form bean validation/descriptor XML will provide the validation information

and


any conversion rules as needed to format/parse between the value object and

the


string representation for the form bean.

That sounds very interesting. I think there is interest in having support for
dynamic forms where the fields of the form are determined dynamically rather
than hardcoded in the JSP. What are the ideas on how to handle dynamic field
names (and number of fields) in Struts 2.0?


Let's say that we are designing a dynamic customer information editing form.
Every user has different preferences on what fields they want to edit or
allowed to edit. Action class accesses a web service and receives a SOAP
response with exactly those fields that are fit for this user. How could Struts
assemble the form dynamically and pre-populate the customer information and
then validate it when the user submits?

Regards,
Mete

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




__________________________________ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/

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



Reply via email to