Also you could "economize" your development by using Struts Dyna-flavored forms 
(generated from xml) instead of writing your own form classes.

Instead, I use a class I wrote that scans a properties file which has a 
comma-separated list of fields and their types, and some other data such as 
desired class name, default access modifier, etc. The class produces source 
files with typed fields (or an all-String version if I'm making a form class) 
and all the getters and setters. Saves all that unnecessary typing. All I do is 
write a properties file for each form and/or value object class I want. You can 
go a step further and create value object classes based on database metadata . 
. .

Erik


-----Original Message-----
From: [EMAIL PROTECTED]
Sent: Jul 7, 2005 7:33 PM
To: Struts Users Mailing List <user@struts.apache.org>
Subject: Re: Using struts forms as Value Objects: your opinion?

An alternative would be to have your form class extend your value object class. 
However, this approach doesn't work for me. My form class fields are always 
Strings (because of HTTP), while my value object fields are whatever types make 
sense (such as Date). I always have value object classes that look very similar 
to my forms, but the types vary. It doesn't bother me.

Check out Jakarta BeanUtils for auto-conversion of field data between form 
class and value object class.

Erik 

-----Original Message-----
From: Vincent <[EMAIL PROTECTED]>
Sent: Jul 7, 2005 7:15 PM
To: user@struts.apache.org
Subject: Using struts forms as Value Objects: your opinion?

Hi,

I'm currently designing and developping an enterprise J2EE application 
based on Struts.
In this application there's a layer of Data Access Object which abstract 
the underlying persistent storage.
For populating my struts' *Form I've imagined first a transfert between 
forms and DAO based on Value Object, associated with helper classes for 
translating from one type to another.
And I realized that struts Form can be in some situations quite good 
transfert objects, and by doing so we economize development of both 
helper classes and VO classes.

What do you thing about using forms as VO? Do you think it's a dirty 
solution? Forms are often mirrors of the database's table.

Thank you for your opinion.

Vincent.


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



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

Reply via email to