What is Struts Flow?

Answer Posted / sandeep garg

ActionServlet acts as a back bone to all the Struts
applications.
Flow:

-->First the request is handled by the either doGet()/doPost
() method of the Action Servlet and it calls the process()
mthod of its own.This method gets the Current Request
Processor associated with the request.

-->Then this request preocessor calls its preocess() method.
(Note:RequestProcessor also one type of Servlet).
This is the actaul place where the request is handled.

-->This method reads the struts-config.xml file and find
outs the Action class by seeing the request url path.
for ex:
incoming request trl path is:/login

struts-config.xml:

<action path="/login" type="Test.LoginClass">
<forward name="Succes" path="/Welcome.jsp"/>
<forward name="failure" path="/Login.jsp"/>
</action>

-->After identifying the Actio class it checks the whether
the request is associtaed with any form bean.This can be
checked by usin the name attribute of athe action element
from the struts-config.xml.

Ex:<form-beans>
<form name="loginForm" type="Test.LoginForm"/>
</form-beans>
<action-mappings>
<action path="/login"type="Test.LoginClass"
name="loginForm">
....
....
</action-mappings>

-->Then it creates the instance of ActionForm and calls the
corresponding getter and setter methods for the incoming
request parameters.Optionally we can validate the request
parameter by calling the validate()method in ActionForm.For
this we need to specify validate="true" and
input="/Login.jsp" in struts-config.xml file.

-->Now the actual request is handled by the Action class by
calling the execute() method.Output of this method
indicates the response of the request.The return type of
this request is ActionMappings ....

Is This Answer Correct ?    36 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of execute() method?

575


What inbuilt themes are provided by struts2?

594


What is strut web xml?

535


Are struts thread safe?

562


how to debug struts project in netbean ?

1924






What is an interceptor stack?

578


What is the use of jsonvalidation in struts?

557


What is actionform in struts?

489


How does interceptor work in struts2?

512


how to get the last 10 elements using logic:iterate in struts with hiernate from database.

4043


How action-mapping tag is used for request forwarding in struts configuration file?

589


What is the purpose of @result annotation?

624


what is ACID test for fresh engineers??what is the pattern??

2372


Which library is provided by struts for form elements like check boxes, text boxes etc?

515


What is the purpose of constant tag in struts.xml?

561