The Controller: ActionServlet and ActionMapping

·         The controller's main job is to map requests to action i.e. the controller is the first component to act in the processing. So, controller function as a backbone for
 a struts based application. Struts have Action class and ActionServlet class which is used as controller. Controller servlet is most core of a Struts based application.


·         The Controller handles all requests from the user and selects the view to return. When the Controller receives a request from user, Controller forwards the request to the appropriate handler, which interprets what action to take based on that request.

Struts provides a ActionServlet class which is responsible for initializing a Struts applications configuration file and receiving all incoming request and on the behalf of request ActionServletpopulating the Form Bean with data, validating the From bean and then selecting the appropriate Action class to execute.The Action class is where the Struts Frameworks is ends and applications model(code) begins.After doing calculations and manipulations Action class returns a key on the behalf of this keyActionServlet class will decides the next view.

·         The ActionServlet Class is controller class that receives all incoming requests for the application. ActionServlet is responsible for initializing the Struts framework for your application.
 Like other servlet ActionServlet must be configured in web.xml (in Web application deployment descriptor).


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More