aspose file tools*
The moose likes Struts and the fly likes When is the class that extends ActionForm executed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "When is the class that extends ActionForm executed " Watch "When is the class that extends ActionForm executed " New topic
Author

When is the class that extends ActionForm executed

Nelson Nadal
Ranch Hand

Joined: Jun 06, 2002
Posts: 170
I have a login.jsp that when you submit the action is /login

it has a LoginAction.java that has a code...



in struts-config.xml


... so when it forwards to "/Search.jsp" my question is...
will it execute the SearchForm.java indicated also in struts-config.xml (below)?



What I only know is, it will only execute if submit a form and the action in the form is action="/search". Or it will still execute even only you forward it to "/Search.jsp"?

Please enlighten me, thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The answer to the question
When is the class that extends ActionForm executed?
is that it never executes. A class doesn't execute at all, ever. Only a method executes.

A better question would be "when do the methods of this class execute?". The answer is that each of the methods are called at different times in the Struts request life cycle.

I'd suggest you study the UML diagrams in the following URL to learn more about the Struts request life cycle and what gets called when.

http://rollerjm.free.fr/pro/Struts11.html

Disclaimer: The above URL applies to Struts 1.1, and is not entirely accurate for later releases. However, I'd still suggest getting an understanding of this version's life cycle and then learning the changes for the particular version that you're using.


Merrill
Consultant, Sima Solutions
Nelson Nadal
Ranch Hand

Joined: Jun 06, 2002
Posts: 170
Thank you very much for prompt reply, will read more on this. Till next time.
 
 
subject: When is the class that extends ActionForm executed