tell me struts flow ?
Answers were Sorted based on User's Feedback
Answer / mukesh
Above answer is correct but more clear is
supose we having Http:/myhost/authorize.do
1. server configure to pass *.do extension to
org.apache.struts.action.ActionServlet via web.xml
2. Action servlet object inspect the uri and try to
match against ActionMapping located in
struts-configuration.xml
3. if intance of appropriate action found it call
perform() .
4. action object handle request and returns next view..
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / a.v.satyanarayana
Struts follows mvc pattern.
Model ; which is represented as bussiness components.
View: at view level we have JSP's
Controler: Actionservlet given by the frame work.
This frame work mainly depends upon two xml files.
1) is web.xml where we are moniteriong the controlerpart.
2) struts.config.xml where action classes are congured.
when a request is submitted, this request is handelled by
the controller.And the actionservlet internally checks into
the struts config.xml and identifies the coresponding
action class.
Instantiate that action class and execute the bussiness
logic in that action class and forwards the request to the
required JSP.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / ram-sd softech
1. When we start a web application based on struts the web
container creates a
servlet object based on
2. The web container creates the request and response
objects.
3. The web container calls the service method of Action
Servlet by passing the request and the response objects.
4. The Code of Action Servlet checks the struts-
config.xml with path /action at action mappings tag we
discussed how is that as earlier (page-8). Now if it is
there then it creates the ActionOne Object then after it
calls the execute method of ActionOne class.
5. After that it forwards to jsp.If any problem eraises
it shows Exception.
6. After that the Web container will start the execution
of .jsp as we discussed in JSP’s.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / venu
When a client makes a request ,The request goes to the
action servlet as we configured in web.xml (for every
request
*.do----->org.apache.struts.action.ActionServlet.).then
action servlet will read struts-config.xml file and it wil
create module config object and then give it(Module config
obkect) to RequestDispatcher(by calling process() method in
request dispatcher .I mean deligating the request to RD by
doing this.Process method is designed as Chain of
responsability design pattern).After deligating the request
to RD by AS ,AS will not do any thing .from here onwards
Request Dispatcher wil take careof every thing like process
the reuest and send the response.RequestDispacher wil check
whether formbean object existed for this form ,if it is
existed it wil reset the form bean by calling reset()
method of form bean.reset() will reset the new values in the
formbean object.I mean in the form bean object is initiating
with the null values when it is created(it creates when
client makes a request itself).then RD wil check whether the
validate attribute is true or not .if it is true then it
does the validation by calling the method validate().This
method wil return
ActionErrors object.After executing the validate method RD
wil check whether the ActionError object is null or not.If
it is not null,then it wil forward the request to Error.jsp
as we configured in struts-config.if it is null, then it wil
cal the its respective action class as we configured in
struct-config.xml and then action class wil cal bussiness
class method .bussiness class method wil cal the DataAccess
layer class method .The response send it to bussiness class
method.bussinesss class method wil send the response to
action class.action class method wil return the response to
RD.then RD send the response to Success.jsp.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is lookupdispatchaction?
Why struts 1 classes are not thread safe whereas struts 2 classes are thread safe?
What is the purpose of execute method of action class?
How to work with error tags?
What is the use of ActionErrors in Struts?
How does interceptor work in struts2?
Does apache tomcat use struts?
what is the disadvantages of using DynaActionForm in struts framework?
In ActionClass we can use only one action i.e execute(), but in DispatchAction we can use multiple actions.My question is , we can use multiple actions in Action class if(action.equals("add") if(action.equals("update"). Then when to use Action and DispatchAction which is frequently in webapplications.
why do we use logic tag library in struts?
What are the ways in which duplicate form submission can occur?
What are different ways to create Action classes in Struts2?