Web tier: servlets, JSP, Web frameworks: why struts framework?, lifecycle of the framework

  1. I am half way through my struts eploration, suddenly i am bewildered by this question, "why struts,and not an ordinary servlet?" "what paved way for their evolution?" from the knowledge i got from various sources, struts uses more declarative traversing than ordinary servlets, am i right?. Are view and controller loosely coupled than ever before? The code quality of servlet increased? what role does a controller play in struts framework? when and who call the controller? and how? in case of ordinary MVC, container calls the servlet using web.xml. Who read the struts-config.xml?i suppose it's the controller. Who call other action classes that does the actual work? again it's the controller, right?. what is the class name of the controller in struts? if possible could you please reply with a complete life cycle of request-response cycle that uses struts framework. please use the actual class name, don't use generic names, like controller. please. krishna prasad
  2. Hi Krishna, The main reason for using something like Struts over a vanilla servlet has to do with separation of logic. Coding straight to servlets tend to yield monolithic results that mix business logic and presentation logic in a way that typically makes the code more difficult to maintain over time. You can certainly write bad code using Struts (and good code using the Servlet API), but Struts approach (as do others) forces you to segment your code a little more cleanly than you otherwise would inside servlet code. A great resource for most of your questions is the Introduction to the Struts Users Guide (assuming you are using 1.3.8). It gives a brief history of why Struts is what it is and gives a description of the life cycle in the last section right after the text "Let's step through how this all fits together." It typically takes a little bit of time to get your head around Struts MVC implementation, but once you do you'll wonder how you ever wrote directly to the Servlet API. ---Pete http://nerdguru.net
  3. Design Patterns, You should grab a good Java design pattern book, and Enterprise Design pattern book. Alot of the frameworks simply implement known design patterns...Struts implement's MVC.