Flow of execution for StrutsDemoApp1 application:-

a)      Programmer deploys StrutsDemoApp1 Struts App in Tomcat web server.

b)      Servlet container creates ActionServlet class obj during server startup or during deployment of StrutsDemoApp1 application based on <I-O-S> that is enable on ActionServlet

c)       ActionServlet activates Struts-f/m software & also reads, verifies Struts cfg file entries to get ideas on resource of Struts App.

d)      End user launches form page on the browser window by typing their request url—— like http://localhost——-

e)      The action url of form page will be gathered (register)

  • From S-C.xml file “/register” (action path) based StrutsAction class name will be gathered (app.RegisterAction)
  • From there form bean that is linked with RegisterAction (based name = “rf” attribute) will be gathered (app.RegistrForm)
  • ActionServlet creates RegisterForm class obj (formbean class obj) & keeps in session scope.
  • ActionServlet class get xxx () methods on RegisterForm class obj to read default from form bean properties.
  • The default data form bean properties will be assigned to form components (text boxes) as initial

f)       End user files up the form page & submits the form page

g)      Based action url of form page the request url will be generated having register.do in it.

url:  http://localhost: 2020/ StrutsApp1/register.do.

h)      Based on “.do” word in request url ActionServlet traps & takes the request:

i)        ActionServlet uses S-C.xml entries to decide form bean, Action class to process the request based on “register” word of request url it will locate RegisterAction (action class), RegisterForm (form bean)

j)        ActionServlet locates form bean class obj (Register Form) from session scope

k)      ActionServlet calls set xxx () on form bean class obj. & writes the form data of form page to form bean properties.

l)        ActionServlet creates RegisterAction class obj.

m)    ActionServlet calls execute (-,-) of RegisterAction class…..

Success                                                              failure

94–> execute (-,-) <———————— 96

Execute () returns ActionForword class obj. with logical name success (94) / failure (96).

46 —————–> 0 <———————————– 47

Based on ActionForword configuration done in Struts config file the success.jsp / failure.jsp will be taken as result page of RegisterAction class

(99-108) —————–> p <———————– 109-119

Success.jsp                                                                   failure.jsp

End    (q) ß—————————————117 (hyperlink in failure.jsp)

             (r) ß————————————– (4-10) (register.jsp)