I think the usual convention of not using ActionForm in Business tier is to separate these tiers.
This helps to reduce business tier dependency on Web tier.
I read a design pattern and modified it to my needs .
Here is what i do.
1. Make a tagging interface like AppForm which is generalized . All the actionForm classes extend ActionForm and implement AppForm.
Now When i pass it to business tier i simply accept AppForm . Then i can type cast it to required class in business tier .
I used it to simply prevent seeing ActionForm in Business tier . I don't know whether it is good idea.
but i really wanted to get rid of the hassle in moving values across form and TO.
If some other framework , ( other than struts) there will be some way to get value from screens and we will make all those object also implement AppForm .
Now one can say that at that time we will make a tagging interface ActionForm . it is ok. but Still it will make it look like a badly written code.
ciao
Sebastian Ho wrote:
Hi
People have been telling me that ActionForm should not be dependent on your TO. Simple because actionForm is for presentation and TO for your business requirement. Sounds logical and right way to go.
Now that I started developing using struts, it is actually not that
simple.
Say I retrieve a TO from database and convert it into a actionForm for display. In this case I have 4 fields for my actionForm but 10 in my TO. (6 are not needed for display). A user updates the 4 fields and the action convert those into TO. In this case, the other 6 fields will be reset to null(or empty) in my database!
To prevent this, I actually need to use hidden fields in my JSP or some other ugly solutions in my Action class. They are still dependent on each others afterall.
Is there a solution to this or I am missing something here?
Thanks
Sebastian Ho
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]