• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between DTO and ActionForm

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Could anybody tell me the difference between dto and actionform. Do we need to use both of them in a application. I am doing some sample programs, so far I didn't use dto. In realworld what is the best practise?

Thank you,
Sudha.
SCJP 1.5
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ActionForms are coupled to your view.

DTO, or 'Data Transfer Objects' are a common object that is transfered between layers.

ie getting an object out of the database, you won't have an ActionForm, you'll have a different object. If you wanted to display that object on a JSP you would transfer the values to the ActionForm and render the page (well, I wouldn't, but I'm not going to make this complicated).

In the other direction, if you were going to save something to a database from a web form. You'd take the values off of the ActionForm, put them on a DTO and send it on its way to your service layer (well, again arguable if you have some sort of facade or other layer, but speaking basically).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic