In struts why we use servlet as action controller?

Questions by sadashivarao   answers by sadashivarao

Showing Answers 1 - 7 of 7 Answers

bhupathi

  • Aug 30th, 2006
 

Here u see, in servlets, we check (.do)url pattern in web.xml for each request(for each servlet) associated with url whatever u mensioned in input jsp/html page. But in case of struts no need to worry about (.do) and what type of request is coming,it can manage each request by seeing .do whatever it may be,

just observe in struts-config.xml, we can configure only for one servlet that is Action Servlet insted of all, bcaz Action sevlet is singleton object that can be shared by  all requests.

            In Servlets,

             each servlet - corresponding url pattern that recognize servet class 

            But in Struts,

             one Action Servlet- here, no need to check url whatever it may be,it will check in the Struts-config.Xml (<action   path=Url that should be matched with url of the input JSP/html page) 

  Was this answer useful?  Yes

Ajit

  • Apr 4th, 2007
 

Since the very purpose of having a controller in the struts framework is to redirect the request to the appropriate action class to process the correspnding business logic, and servlet is the gateway to the web-container for each http request. So a servlet fits best for the controller role here.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions