questions about struts

S

sunny liu

I'm new to struts, Do I have to create one ActionForm for each action?
If there are three buttons on one page?
 
O

Oscar kind

sunny liu said:
I'm new to struts, Do I have to create one ActionForm for each action?
If there are three buttons on one page?

No. Generally it's one ActionForm per JSP page (to match the form fields).

The number of actions depends on your design:
- One Action per JSP page that handles all actions from that page.
Easy structure to work with, but it's also easy to make one Action do
several things (not clean OO IMHO, as one object should have one
purpose).
- One action per business action.
Easy to understand, but muddles the separation between model and
controller (according to the docs, Action's are part of the controller).
- One Action overall that passes all actions to the business model.
Easy to work with, but it's dangerous: you must be really sure all input
is checked, as you pass it directly into the business layer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top