This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes ActionForm method call sequence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionForm method call sequence" Watch "ActionForm method call sequence" New topic
Author

ActionForm method call sequence

wrushasen dakhane
Ranch Hand

Joined: Sep 25, 2006
Posts: 47
Hi ,

Can anybody tell the sequence of the methods that are called when any new request come and the ActionForm gets pouplated?

And also when the form which is already in session then in that case what will be the sequence.

I am little confuse in this.

Wrushu


SCJP 1.4, SCWCD 1.4
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Here is the sequence of events as I understand them.
  • Check to see if there is an existing bean in the declared scope. If no bean exists, instantiate one ant put it in the declared scope
  • Call reset()
  • Evaluate the contents of the request and call setter methods on the bean as necessary
  • If the action mapping specifies validate="true" call validate()

  • [ April 13, 2007: Message edited by: Merrill Higginson ]

    Merrill
    Consultant, Sima Solutions
    wrushasen dakhane
    Ranch Hand

    Joined: Sep 25, 2006
    Posts: 47
    What if the form bean doesn't already exits in the scope?

    Will the reset() method will get called on that?
    Brent Sterling
    Ranch Hand

    Joined: Feb 08, 2006
    Posts: 948
    I am pretty sure that reset will always get called. I use request scope 99% of the time so I seldom ever (never?) write a reset method.

    - Brent
     
    Consider Paul's rocket mass heater.
     
    subject: ActionForm method call sequence
     
    Similar Threads
    how to code for checkboxes on forms?
    Sequence Diagrams and Use cases questions
    Auto pre-selection of drop down boxes.
    overloading
    load checkbox items at startup