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

How can duplicate form submission be handled in struts 2?

539


How does interceptor work in struts2?

506


How can link tag’s action attribute be used?

522


If the framework doesn’t do what I want, can I request that a feature be added?

504


What's mvc pattern ?

586






Why do we need struts?

544


Name some useful annotations introduced in Struts2?

530


What is the need of struts?

566


How many Action classes have been used in your project? Differences between struts 1.1 and 1.3?

2532


Can we have multiple struts config files ?

539


What is the purpose of action-mappings tag in struct-config.xml?

592


What are the benefits of Interceptors in Struts2?

651


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

516


What is action class?

581


How we can controlled duplicate form submission in struts?

520