what is request processor class ?

Answer Posted / rajesh

We say that ActionServlet is the backbone of the struts application but actually it just receives the request and invoke RequestProcessor process() method and this RequestProcessor processes all aspects of the request.
If the above is true , then RequestProcessor should be the heart of struts application or do we consider {ActionServlet + Requestprocessor} as a single unit when we say "ActionServlet is the backbone of the struts application".

1. ActionServlet receives the request.
2. The doPost() or doGet() methods receive a request and invoke the process() method.

3. The process() method gets the current RequestProcessor and invokes the RequestProcessor. process() method

4.The RequestProcessor.process() method is where the current request is actually serviced. This method retrieves, from the struts-config.xml file, the <action> element that matches the path submitted on the request. It does this by matching the path passed in the <html:form /> tag's action element to the <action> element with the same path value

5. When the RequestProcessor.process() method has a matching <action>, it looks for a <form-bean> entry that has a name attribute that matches the <action> element's name attribute.

6. When the RequestProcessor.process() method knows the fully qualified name of the FormBean, it creates or retrieves a pooled instance of the ActionForm named by the <form-bean> element's type attribute and populates its data members with the values submitted on the request

7. After the ActionForm's data members are populated, the RequestProcessor.process() method calls the ActionForm.validate() method, which checks the validity of the submitted values.

8. At this point, the RequestProcessor.process() method knows all that it needs to know and it is time to actually service the request. It does this by retrieving the fully qualified name of the Action class from the <action> element's type attribute, creating or retrieving the named class, and calling the Action.execute() method

9. When the Action class returns from its processing, its execute() method returns an ActionForward object that is used to determine the target of this transaction. The RequestProcessor.process() method resumes control, and the request is then forwarded to the determined target.

10. At this point, the ActionServlet instance has completed its processing for this request and is ready to service future requests.


Most of the controlling work is done by RequestProcessor and still we say ActionServlet is the backbone ?

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is struts and why it is used?

590


Is struts 1 still supported?

594


What are the two types of validations supported by validator framework?

672


What design patterns are used in struts?

652


Which interceptor is responsible for mapping request parameters to action class Java Bean properties?

637






What is the purpose of @typeconversion annotation annotation?

633


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

706


Are struts still used?

591


What is the use of struts config xml file?

567


Whats the difference between the default namespace and the root namespace?

601


What is action class? What are the types of action class?

603


What does execandwait interceptor?

630


What are the Core classes of Struts Framework?

672


When should be opt for struts framework?

678


What is struts 2 framework in java?

637