Struts Novice: Using Action/ActionForms?

Discussion in 'Java' started by gilgantic, Feb 4, 2004.

  1. gilgantic

    gilgantic Guest

    Few random questions about Struts:
    (Note: I left out ActionServlet and Model classes out of my questions)
    1. Should every JSP have one "ActionForm" and "Action" class associated with it?
    2. Is Action-to-Action (Action Chaining) possible? If so, is it a good practice?
    3. Is the normal flow JSP (POST)-> Action -> ActionForward -> ActionForm -> JSP?
     
    gilgantic, Feb 4, 2004
    #1
    1. Advertising

  2. gilgantic

    Sudsy Guest

    gilgantic wrote:
    > Few random questions about Struts:
    > (Note: I left out ActionServlet and Model classes out of my questions)
    > 1. Should every JSP have one "ActionForm" and "Action" class associated with it?
    > 2. Is Action-to-Action (Action Chaining) possible? If so, is it a good practice?
    > 3. Is the normal flow JSP (POST)-> Action -> ActionForward -> ActionForm -> JSP?


    Start here:
    <http://www.sudsy.net/technology/struts-arch.html>
    Then read the other articles in the same family.
    To answer your questions:
    1. Not necessarily. That's not ducking the question, BTW. You might have
    a search facility included on the page which would submit to a
    different action.
    2. Certainly possible but you'd have to carefully consider the potential
    for side-effects.
    3. No. POST->ActionForm->Action->ActionForward->JSP. The article I cited
    includes a nice flow-chart.
     
    Sudsy, Feb 4, 2004
    #2
    1. Advertising

  3. gilgantic

    Larry Guest

    See below...

    "gilgantic" <> wrote in message
    news:...
    > Few random questions about Struts:
    > (Note: I left out ActionServlet and Model classes out of my questions)


    > 1. Should every JSP have one "ActionForm" and "Action" class associated

    with it?
    Normally, yes. If your JSP has a <form> tag and POST, then you should have
    an ActionForm for validation of the form data and an Action to process the
    form.

    > 2. Is Action-to-Action (Action Chaining) possible? If so, is it a good

    practice?
    An Action class is just a hybrid Servlet, so and Action class can call
    another action class. Typically, you would call another JSP to display
    results, etc. We have used Actions to call another Action in special cases
    (like passing data from a process type Action to an Action that generates a
    list of that data).

    > 3. Is the normal flow JSP (POST)-> Action -> ActionForward ->

    ActionForm -> JSP?
    The processing flow is JSP -> ActionServlet -> ActionForm -> Action -> JSP.
    ActionServlet (the Controller) is called behind-the-scenes via your mapping
    in struts-config.xml, which in turn calls your ActionForm. The ActionForm
    (just a JavaBean container for data) must be loaded with the data from your
    JSP so the Action can "execute" it.
     
    Larry, Feb 7, 2004
    #3
    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. Joe Bloggs
    Replies:
    1
    Views:
    951
    Sudsy
    Aug 3, 2003
  2. =?ISO-8859-1?Q?Ra=FAl_Ant=F3n_Cuadrado?=

    struts and ActionForms

    =?ISO-8859-1?Q?Ra=FAl_Ant=F3n_Cuadrado?=, Sep 4, 2003, in forum: Java
    Replies:
    2
    Views:
    388
    =?ISO-8859-1?Q?Ra=FAl_Ant=F3n_Cuadrado?=
    Sep 5, 2003
  3. Brian Trapp
    Replies:
    0
    Views:
    665
    Brian Trapp
    Apr 29, 2005
  4. Binoj A via JavaKB.com

    How create dynamic Actionforms in struts

    Binoj A via JavaKB.com, Aug 9, 2005, in forum: Java
    Replies:
    0
    Views:
    390
    Binoj A via JavaKB.com
    Aug 9, 2005
  5. Replies:
    3
    Views:
    466
    Tim Slattery
    Nov 20, 2007
Loading...

Share This Page