• 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

(Struts) Any class that can do introspection for me?

 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am currently developing an application using Struts. I have chosen to move the data from my ActionForm to a DataObject. This has worked pretty well so far because data that must be saved at the same time can come from multiple data entry screens. With the DataObject, I can just stuff values from the ActionForm and pass the DataObject around until it is time to save it. It has also helped me keep the API to the persistence layer relatively simple as I usually just pass a DataObject to/from it.
Each of my ActionForm classes has a copyTo(DataObject) and copyFrom(DataObject) method. The methods basically do what Struts does with the JSP/request and the ActionForm: moves values of attributes between the two.
Questions:
1. What do you think of the approach I am using?
2. Are there any issues that I may encounter later by using this approach?
3. I am currently manually copying fields to and from the ActionForm and DataObject. This is getting more unwieldy as I add more fields to the ActionForm and DataObject. Is there a way to automate this process without having to write my own reflection-based utility class? That is, is there a class/method in Struts that can do this? (I could dig around the Struts source and see for myself but if anyone knows offhand, it would save me some time and effort )
TIA!
Junilu
[This message has been edited by JUNILU LACAR (edited November 03, 2001).]
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by JUNILU LACAR:
I am currently developing an application using Struts. I have chosen to move the data from my ActionForm to a DataObject. This has worked pretty well so far because data that must be saved at the same time can come from multiple data entry screens. With the DataObject, I can just stuff values from the ActionForm and pass the DataObject around until it is time to save it. It has also helped me keep the API to the persistence layer relatively simple as I usually just pass a DataObject to/from it.
Each of my ActionForm classes has a copyTo(DataObject) and copyFrom(DataObject) method. The methods basically do what Struts does with the JSP/request and the ActionForm: moves values of attributes between the two.
Questions:
1. What do you think of the approach I am using?
2. Are there any issues that I may encounter later by using this approach?
3. I am currently manually copying fields to and from the ActionForm and DataObject. This is getting more unwieldy as I add more fields to the ActionForm and DataObject. Is there a way to automate this process without having to write my own reflection-based utility class? That is, is there a class/method in Struts that can do this? (I could dig around the Struts source and see for myself but if anyone knows offhand, it would save me some time and effort )
TIA!
Junilu
[This message has been edited by JUNILU LACAR (edited November 03, 2001).]



Hi Junilu. I think your approach is fine -- it's exactly what I've done in my own struts code and in the articles on struts that I wrote.
I don't think there's anything in struts like you describe. Sounds like you're going to have to write a utility class to me...
Kyle

------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
If you settle for what they are giving you, you deserve what you get. Fight for 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