Note before reading this article : this is not for professionals and it is for the people who stepped into Struts(Beginners) and it is for my future reference.
1. When the jsp page is loaded into server, the "" (what you wrote in corresponding jsp page) creates the neccessary html code to represent the form and then checks for the instance of the corresponding ActionForm in the current session scope.If there was ActionForm object available in the session scope then the data members of the ActionForm is mapped with the input form fields respectively. and then that jsp page is presented to the user.
Let me explain with one example.
JSP pages: login.jsp, success.jsp
Action class: LoginAction
Form name: LoginForm
in login.jsp
two fields username and password
login.jsp
2.When you click on Login button the server receives that request and it wil check in web.xml for the form action with login.do
In web.xml there you can see the following url mapping with .do extension. then it calls the ActionServlet
From there the ActionServlet will take the request processing.
3.the ActionServlet will then looks for the LoginForm and populates the data members with form fields and then the LoginForm will be associated with the session.
4.Once, the request comes to the ActionServlet the ActionServlet [ActionServlet will call the RequestProcessor's process()method.
The RequestProcessor's process() method] wil read the struts-config.xml file and looks for the following entry:
if the path attribute equals to the form action attribute
the execute() method will process the business logic [by calling the model component] and then calls the ActionMapping.findForward("string argument") can be success or failure.
6.this ActionMapping.findForward("string argument") will looks for the
lookup, which is the value of the path attribute /welcome.jsp (upon success) or /login.jsp (upon failure).
If it is success then the LoginAction returns the ActionForward object to the ActionServlet, which will then forward to the view for presentation.
here now you can see welcome.jsp
uhhhhhh......, I did it. please give me feedback.
resources i have used to write this
Mastering Jakarta Struts book by James Goodwill[It is a good book for struts]
and my class notes.