The controller servlet is the struts ActionServlet class. You configure this in your web.xml file so that it sends all requests whose path ends in .do (or whatever extension/path mapping you choose for your actions) to this servlet.
The ActionServlet will actually make use of another class to do the bulk of its work when a request comes in (in struts1.1). This is the RequestProcessor. It examines the path and looks up the appropriate ActionMapping for that path that you have defined in struts-config.xml. >From the information in the ActionMapping it determines which ActionForm class you want to use and in which scope it should be, creates an instance if necessary and populates it from the parameters in the request. Then the RequestProcessor will pass the ActionForm, and references to the request, response, and ActionMapping to the execute method of your Action class. (The first time this Action is used it will instantiate the action object. All subsequent requests in all threads will reuse the same instance that it created the first time). Your Action will (usually) return an instance of ActionForward, and the RequestProcessor will then forward the request to the path specified in the ActionForward (doing a client side redirect if the redirect property is true). In the event that an exception is thrown by your Actions execute method, and you defined an ExceptionHandler in struts-config.xml for it, the RequestProcessor will instead pass control to this ExceptionHandler. Basically the ActionServlet is the controller, but it delegates the processing of requests to the RequestProcessor. The RequestProcessor determines which Action should handle that request and calls it, so your Actions fit into the controller part of the MVC architecture along with the ActionServlet and RequestProcessor. (Other tasks of the ActionServlet include parsing the struts-config.xml file at application startup, and calling at startup any PlugIns you have configured). You may subclass the ActionServlet to customise its behaviour, but under struts1.1 this is less useful to do - in 1.1 if you need to customise that behaviour you would usually subclass the RequestProcessor. You can specify which RequestProcessor class to use in your struts-config.xml file. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, 4 February 2004 22:58 To: [EMAIL PROTECTED] Subject: what is controller servlet in struts framework Hi guys I have been having a question. I do not understand what is the controller servlet in the struts framewrok. Is it the Action classes or struts-config.xml that is the controller servlet for struts framework. Please let me know Thanx --Mohan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]