questions about struts

Discussion in 'Java' started by sunny liu, Oct 21, 2004.

  1. sunny liu

    sunny liu Guest

    I'm new to struts, Do I have to create one ActionForm for each action?
    If there are three buttons on one page?
     
    sunny liu, Oct 21, 2004
    #1
    1. Advertising

  2. sunny liu

    Oscar kind Guest

    sunny liu <> wrote:
    > 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.


    --
    Oscar Kind http://home.hccnet.nl/okind/
    Software Developer for contact information, see website

    PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
     
    Oscar kind, Oct 21, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Katie Wright
    Replies:
    8
    Views:
    4,257
    Andrea Desole
    Jan 7, 2005
  2. Jason Us
    Replies:
    0
    Views:
    994
    Jason Us
    Oct 4, 2003
  3. jc1771
    Replies:
    0
    Views:
    409
    jc1771
    Dec 28, 2003
  4. sin
    Replies:
    3
    Views:
    726
    Sudsy
    Feb 22, 2004
  5. Pratap Das
    Replies:
    2
    Views:
    2,035
    Pratap Das
    Apr 5, 2004
Loading...

Share This Page