How to explain struts work flow
Answers were Sorted based on User's Feedback
Answer / madhu
1) A request comes in from a Java Server Page into the
2) The ActionServlet having already read the
struts-config.xml file, knows which form bean
relates to this JSP, and delegates work to the validate
method of that form bean.
3) The form bean performs the validate method to determine
if all required fields have been entered, and performs
whatever other types of field validations that need to be
4) If any required field has not been entered, or any field
does not pass validation, the form bean generates
ActionErrors, and after checking all fields returns back to
5) The ActionServlet checks the ActionErrors that were
returned from the form bean’s validate method to determine
if any errors have occurred. If errors have occurred, it
returns to the originating JSP displaying the appropriate
6) If no errors occurred in the validate method of the form
bean, the ActionServlet passes control to the appropriate
7) The Action class performs any necessary business logic,
and then forwards to the next appropriate action (probably
|Is This Answer Correct ?||167 Yes||14 No|
Answer / pradeep kumar simhadri
1) When a user submitted a jsp page. that page having
(attribute of )action="login.do". the container will call
to WEB.XML. in that web.xml thert is two section servlet
And servlet mapping
2) In servlet mapping it find *.do in the url-pattern. if
it found to take the name of servlet. and check the
corresponding class. in the servlet section. that class is
3) ActionServlet is the controller of Struts module
architecture. in Action servlet having the service method.
in that method we create RequestPrecessor class instance
RequestPrecessor rp = new RequestPrecessor();
5) We call a process method of RequestProcessor class
through the instance rp.process(req,res)
6) In the request processor class have the process method
with the parameter of req,res. then it has 1 if condition
in this class. that condition return always true. because
that is dummy method.
7)Inside that condition ther is 6 steps are processing
a)Create a action mapping instance in the "Struts-
Config.xml". it will kept all details of the action mapping
path, value, type forward, validation=true/false, input
="*.jsp" etc these r created instance
b)Then it will create Form class instance before it check
the name of action mapping and form name are coincidence or
not if it same it will create form instance
c)Then it will go to ActionMapping instace the ris mention
or not the validate =true/fale if false it will not execute
the this step else it will execute this step.
d) Then it will create action instance
e) Next it will take four parameters of execute Method it
will return ActionErrors instance. if it is not empty. it
will go to error page other wise it will got to
corresponding page. else if it is empty if will go further
and display corresponding value of page in jsp view.This is
|Is This Answer Correct ?||80 Yes||11 No|
Answer / mahmood alam siddiqui
Struts work flow:
When user run the Struts Application
first of all controll goes in XML file and find the Action
Servlet that is main controller class in Struts after that
control goes in Struts-config.xml and find the Action, find
the Form bean and execute the action if method execute
successfully the forward the output at given JSP.
|Is This Answer Correct ?||101 Yes||36 No|
Answer / aleem
when client makes the request,the request goes to web.xml
files <url-pattern> tag from here it goes to <servlet> tags
<servlet-class> there ActionServlet is loaded into the jvm,
and it is instantiated,initialized with in its init method,
Now the responsibility of actionServlet is to identify the
request processor,by using <inti-param> tag,after request
processor identified ,ActionServlet creates the instance of
the request processor,on that instance of request processor
calls the process(), as a result request reaches to the
the next responsibility of requestprocessor is to identify
the Action,using the client requestd uri.if client requested
uri and struts-config's path attributes are same then it
checks for the name attribute,if name attribute is found the
it goes to the <form-bean>tag there it check,if found ,sees
whether the form bean instance is available in the request
scope or not ,if found it instance set the request parameter
values by calling setxxx methods.then request reaches to the
Action. action returns the ActionForward object, using which
<forward> tag forwards to the appropriate jsp.
|Is This Answer Correct ?||43 Yes||11 No|
Answer / karthick prabu.v
1) when the client send a request first it will goes to the
2) there it will check the ActionServlet class(contoller).
3)From there it goes to the struts config.xml file
4)in the config.xml file it checks the form bean class and
5) then the controll goes to the model class.(Action class).
6)execute the logic in the action class.
7) after completion of the execution it send some response
to the controller.
8)then the controller goes to the config.xml file and checks
the where the controller have to go.
9)again it come back to the controller and goes to the
related jsp file.
10)there the jsp file execute and give the out put to the
|Is This Answer Correct ?||23 Yes||6 No|
Answer / jayachender
When we send the request the follwing actions will be perform.
1.The Server Searches for Deployment-Descriptor(web.xml)
2.If the server Found <load-on-startup> tag the server will create the required Servelet Object.
3.After Servlet object is created the server will execute the init() method of ActionServlet.
4.As part of init method of ActionServlet finds the value of Config init parameter.
5.The init() method start reading contents from the struts-config.xml(Struts Configuration file) and store the information in jvm's Memorey
|Is This Answer Correct ?||21 Yes||8 No|
Answer / mairaj
1) The request received by hte ActionServlet which is the
default Controller in Struts...
2)ActionServlet then call RequestProcesser.preProcess
method to find the formbean populate the value to it
validate the values..
3)Once the validating has finished the ActionServlet's
RequestProcesser.preProcess() method call Action class's
execute method where the original business processing
4)The action class process the method and reurns the result
5)In returning the Action class provides the key to the
corresponding ActionServlet to determine the reult acqiured
fromprocessing will be diplayed...
6)The ActionServlet then display results to client using
the key provided by the action class..
Hope You understand well..!!
|Is This Answer Correct ?||16 Yes||10 No|
Answer / bhoorgu rakesh
1.Browser sends the request to uor Container ,container Communicate with web.xml for wich url matches that container forward url to actionServlet
2.Action servlet search wich sub control invoke by using struts-config.xml
3.Action servlet assign form data to ActionForm to create form object
4.ActionServlet gives ActionClasss wich execute()
5.action class connect to model execute BusinessLogic
6.Model class connect util class to establish connections
7.model communicate with the DataBase
8.DataBase gives to model if any logic is their ,then execute that logi
9.moddel communicate with the ActionClass
10.ActionClass communicate with the Memory
11.ActionClass send the logical jsp name to ActionServlet
ActionServlet takes that logical jspname search in the struts-config.xml to call exactly jsp
12.ActionServlet call extacly jspname
13.View communicate with the Memory
14.view page sends the response to Browser
|Is This Answer Correct ?||6 Yes||2 No|
Answer / shiva
1. A request comes in with a .do extension, the container maps it to
2. The ActionServlet acts like a front end controller and dispatches
control to a RequestProcessor.
3. The RequestProcessor finds an action tag with a path attribute that
matches the incoming request
4. Then the RequestProcessor looks for a form-bean tag that has a name
attribute that matched the action tags name attribute.
5. RequestProcessor instantiates a FormBean of the of based on the type
6. RequestProcessor calls populates the FormBeans fields from the
incoming request, then calls its reset method, then its validate method
7. RequestProcessor instantiates an Action based on the action tags
8. RequestProcessor calls the action's execute method which returns
9. The RequestProcessor finds a matching ActionForward first within the
nested forward tags, then from within the global-forwards tag.
Note: if the validate method returns an ActionMessage then the
RequestProcessor forward the request to the resource specified in the
action's input attribute
|Is This Answer Correct ?||4 Yes||1 No|
Answer / manu
client send the request to the server,
after that the struts internal code will take care of
everything......y do we suffer?
this is called struts flow
|Is This Answer Correct ?||9 Yes||17 No|
What is the difference between validation.xml and validator-rules.xml files in struts?
we have two applications A1 & A2 both are accesing the same databse table employee at the same time how we will manage this so that both application can get the correct no of emloyee while A1 is inserting a employee at the same time while other applicatuion is getting the empployee list.
Why is action servlet a singleton in struts?
What is actioninvocation?
What is the purpose of @createifnull annotation annotation?
Why should we go for struts framework?
What is the use of reset method of ActionForm class?
What is the purpose of @conversion?
How many instances of servlet usually run in a struts application ?
struts 1.3 features?
project architechture in java
When wil use singleton class in Struts