What is Struts Flow?

Answer Posted / aadil rashid

1) When application server gets started,container loads the
web.xml

2) When first the request is made from a JSP/HTML/XSLT to
the server with a particular URI(/something.do) the control
first reaches Web.xml file.

3) It checks the mapping for /something.do in web.xml and
finds the ActionServlet and loads ActionServlet.

4) As part of loading ActionServlet calls the init() as
every other servlet does.
(Note: ActionServlet extends HttpServlet only)
......................
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
........................

5) In init() it takes the init-parameters as
struts-config.xml and loads the xml file.

6) Then the ActionServlet calls the process() method of
RequestProcessor class.

7) process() method checks for the appropriate action in the
action mapping for current request and maps the URI to the
action in the struts-config.xml.

8) Then it creates an object to ActionForm associated to
that action.

9) It then calls the setters and reset() methods in the form
bean(Which extends ActionForm) corresponds to the mapped
action.

10) If the action tag in struts-config.xml contains validate
"true" then the validate method is called.

11) if any validation errors it return to view component
(any jsp XSLT) which is specified as an attribute of input
"/error.jsp"

12) if there are no validation errors ,it then search for
execute method in the action class and executes it.

13) execute method performs the bussinesslogic which you
provide and returns with an ActionForward key.

14) Now the returned key is searched in the mapped action
which is specified as forward tag.

15) It looks for the appropriate view component and performs
the getters on that action form corresponding to this view
component and loads the view page in the browser.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List some struts tag libraries?

641


Who wrote struts?

634


What are interceptors in struts 2?

672


What’s the difference between struts and turbine? What’s the difference between struts and espresso?

626


What are action errors and error?

660






Why is it called struts?

621


Can we handle exceptions in Struts programmatically?

595


How can we get Servlet API Request, Response, HttpSession etc Objects in action classes?

703


What is package name in struts xml?

661


What is struts xml?

525


How to display validation errors on jsp page?

669


What are best practices to follow while developing Struts2 application?

687


What is the use of jsonvalidation?

679


Explain the difference between jakarta struts and apache struts?

610


What is the use of web xml in struts2?

615