• 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

Moving Data from View to Model and vice versa

 
Ranch Hand
Posts: 96
Scala VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you normally do this?

We have been using two methods.

We instantiate an ActionForm from our model bean to move data from business to struts.

In each ActionForm, we have a populate method that fills in various pieces of a model bean for that particular form.

Is this fairly typical?

Thanks.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The approach you describe is pretty common. One that I use quite often is the "Value Object" or "Transfer Object" pattern. Using this pattern, you create objects that belong neither to the view, nor to the model, but are used to shuttle information to and from the two. When using struts, I sometimes find it convenient to embed the value object into the form as a property, and then use nested tags to get at the information.

Here's a link with some good information about this and other J2EE patterns.

http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html
 
Water proof donuts! Eat them while reading this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic