Re: ASP.NET and Struts: Web Application Architectures MVC1 was a first generation approach that used JSP pages and the JavaBeans component architecture to implement the MVC architecture for the Web. HTTP requests are sent to a JSP page that implements Controller logic and calls out to the “Model” for data to update the “View.” This approach combines Controller and View functionality within a JSP page and therefore breaks the MVC paradigm. MVC1 is appropriate for simple development and prototyping. It is not, however, recommended for serious development. The MVC2 architecture is actually a modified MVC implementation. The major modification is that the Model no longer fires events to its Views. The central issue is that the life cycle of the servlet (the Controller and View) is not necessarily the life cycle of the application, as it is with desktop applications. The servlet begins with a user request, typically generated by a Web browser, and ends with the response. The Model, however, may, and typically does, persist across the life of multiple
servlets. Therefore, it cannot reliably notify View objects of internal state changes.
This has the following consequences:
1.The Model is now more “generic,” because it no longer implements the logic for registering and unregistering listeners, nor does it need to implement logic to generate events.
2.The View is now responsible for capturing Model state changes.
3.The Controller now notifies the View of state changes to the Model.
4.The Controller must manipulate the Model before notifying the View. |