Tuesday, July 27, 2010

MVC1 Vs MVC2

I was reading on internet about MVC 1 and MVC 2. I got this difference for quick learners I hope this will be helpful.

MVC is a design pattern. It contains two models. MVC Model 1 MVC Model 2.Struts framework implements MVC Design Pattern. Struts can implement Model 1 and Model 2.


Model 2 most properly describes the application of MVC in a Web-Application context.

  • Following are the important feature of MVC1 architecture:
    • HTML or JSP files are used to code the presentation. JSP files use java beans to retrieve data if required.
    • MVC1 architecture is page-centric design all the business and processing logic means any JSP page can either present in the JSP or may be called directly from the JSP page.
    • Data access is usually done using Custom tag or through java bean call.Therefore we can say that in MVC1 there is tight coupling between page and model.
  • Following are the important feature of MVC2 architecture:
    • This architecture removes the page-centric property of MVC1 architecture by separating Presentation Control logic and Application state
    • In MVC2 architecture there is one Controller which receive all request for the application and is responsible for taking appropriate action in response to each request. Second one is Model which is represented by JavaBeans business object and database. Third one is View or is JSP page it takes the information provided by Controller and Module and presents it to user.

Figure 1: JSP Model 1 architecture
JSP Model 1 Architechture

Figure 2: JSP Model 2 architecture
JSP Model 2 Architechture

For more Information you can read this article on JavaWorld

No comments:

Post a Comment