T
tom
Hello,
I have a relatively simple application I am building using Struts 1.1.
I've just started using this framework so I'm not quite up to speed yet. My
question is in relation to the action forms: where should I put all my
business logic? For example, I've got a an action form with about 20 values
(ie get/set methods) and if they all validate properly I'd like to submit
this to a database.
What I have read here in this newsgroup is that in your Action you
should first get the formBean and then submit this to a javaBean. The
question I have is: should I write a new javaBean with exactly all the same
values as the formBean, and in that javaBean write the methods to write to a
database, and others I would like to implement such as "toXML()" method?
Let's say I take that approach--this brings me to my next question then: is
there an easy way to send all the "values" from the formBean to the
javaBean, or do I have for example like this:
customerForm f = (customerForm) form;
customerBean cb = new customerBean();
cb.setName(f.getName());
cb.setAddress(f.getAddress());
.... and so forth for about 20 or so values?
And lastly, is there an easy way to serialize the javaBean to XML?
Lots of questions here! Thank for any help!
-Tom
I have a relatively simple application I am building using Struts 1.1.
I've just started using this framework so I'm not quite up to speed yet. My
question is in relation to the action forms: where should I put all my
business logic? For example, I've got a an action form with about 20 values
(ie get/set methods) and if they all validate properly I'd like to submit
this to a database.
What I have read here in this newsgroup is that in your Action you
should first get the formBean and then submit this to a javaBean. The
question I have is: should I write a new javaBean with exactly all the same
values as the formBean, and in that javaBean write the methods to write to a
database, and others I would like to implement such as "toXML()" method?
Let's say I take that approach--this brings me to my next question then: is
there an easy way to send all the "values" from the formBean to the
javaBean, or do I have for example like this:
customerForm f = (customerForm) form;
customerBean cb = new customerBean();
cb.setName(f.getName());
cb.setAddress(f.getAddress());
.... and so forth for about 20 or so values?
And lastly, is there an easy way to serialize the javaBean to XML?
Lots of questions here! Thank for any help!
-Tom