Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

ActionServlet , RequestProcessor - Flow ?

 
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
content copied from Professional Struts 1.1 by Wrox publications
 
Mohd Asim
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The requestprocessor is just an abstraction used for convenience. we cud have done the same thing in the actionservlet also. The ActionServlet is architecturally the backbone coz the framework (struts) wud not work without a centralized controller.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding is that in Struts 1.0 all of the processing was in the ActionServlet class and that in Struts 1.1 the RequestProcessor class was introduced to give developers better hooks for customizing Struts behavior. Does it really matter which one gets the "backbone" label?

- Brent
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohd,

Please read this link.
[ September 27, 2007: Message edited by: Merrill Higginson ]
 
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic