Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
...nobody




JSPWiki v2.2.33

[RSS]


Hide Menu

ValueObjectInForm


Difference between version 3 and version 2:

At line 5 changed 9 lines.
When I first started developing with Struts (pre 1.0), I'd just have a
simple form with a DTO (VO back then) as a getter/setter on my form. In the
last year, I've changed to have a DTO and a Form, where the DTO has the true
data types (Long, Date, etc) and the form has only Strings. After doing it
both ways, it seems like the DTO as a getter/setter is really the better way
to go. I'm not trying to say it's the *right* way according to the design
patterns, I'm just offering my $.02 from experience. I continue to do it the
BeanUtils.copyProperties() way, but the projects I work on that do it the
other way seem cleaner.
When I first started developing with Struts (pre 1.0), I'd just have a simple form with a DTO (VO back then) as a getter/setter on my form. In the last year, I've changed to have a DTO and a Form, where the DTO has the true data types (Long, Date, etc) and the form has only Strings. After doing it both ways, it seems like the DTO as a getter/setter is really the better way
to go. I'm not trying to say it's the *right* way according to the design patterns, I'm just offering my $.02 from experience. I continue to do it the BeanUtils.copyProperties() way, but the projects I work on that do it the other way seem cleaner.
At line 15 changed 2 lines.
For an example of a DTO -> BeanUtils.copyProperties() -> Form, check out the
following links:
For an example of a DTO -> BeanUtils.copyProperties() -> Form, check out the following links:
At line 10 added 1 line.
{{{
At line 20 changed 1 line.
Conversion -> UserManagerImpl.java (source: [http://tinyurl.com/emof] - see convert() method). This extends BaseManager ([http://tinyurl.com/emok]), which registers custom converters. No DateConverter in this example, but I've done it at my day job, so I know it's fairly easy.
Conversion -> UserManagerImpl.java (source: [http://tinyurl.com/emof]
- see convert() method). This extends BaseManager ([http://tinyurl.com/emok]),
which registers custom converters. No DateConverter in this example,
but I've done it at my day job, so I know it's fairly easy.
At line 19 added 2 lines.
}}}
''from the [struts-user mailing list|http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg69836.html].''

Back to ValueObjectInForm, or to the Page History.