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