Model 1 and Model 2 (MVC) Architecture


Before building up the web applications, we need thought regarding design models. There are two kinds of programming models (design models)

  1. Model 1 Architecture
  2. Model 2 (MVC) Architecture

Model 1 Architecture

Servlet and JSP are the develop advancements to build up the web applications.

Servlet was viewed as better than CGI. Servlet innovation doesn't make process, rather it makes string to deal with solicitation. The upside of making string over procedure is that it doesn't apportion separate memory zone. Along these lines numerous consequent solicitations can be effectively dealt with by servlet.

Problem in Servlet technology Servlet needs to recompile if any structuring code is adjusted. It doesn't give detachment of concern. Introduction and Business logic are blended up.

JSP defeats practically every one of the issues of Servlet. It gives better partition of concern, presently introduction and business logic can be effectively isolated. You don't have to redeploy the application if JSP page is changed. JSP offers help to create web application utilizing JavaBean, custom labels and JSTL with the goal that we can put the business logic separate from our JSP that will be simpler to test and investigate.

model 1 architecture>

As you can find in the above figure, there is picture which demonstrate the progression of the model1 architecture.

  1. Browser sends demand for the JSP page
  2. JSP gets to Java Bean and summons business logic
  3. Java Bean associates with the database and get/spare data
  4. Response is sent to the program which is produced by JSP

Advantage of Model 1 Architecture

  • Easy and Quick to create web application

Disadvantage of Model 1 Architecture

  • Navigation control is decentralized since each page contains the logic to decide the following page. On the off chance that JSP page name is changed that is alluded by different pages, we have to transform it in every one of the pages that prompts the upkeep problem.
  • Time consuming You have to invest more energy to create custom labels in JSP. With the goal that we don't have to utilize scriptlet tag.
  • Hard to extend It is better for little applications yet not for substantial applications.

Model 2 (MVC) Architecture

Model 2 depends on the MVC (Model View Controller) plan design. The MVC design design comprises of three modules model, see and controller.

Model The model represents to the state (data) and business logic of the application.

View The view module is spend to show data for example it represents to the presentation.

Controller The controller module goes about as an interface among view and model. It catches every one of the solicitations for example gets info and directions to Model/View to change presentation.

mvc architecture

Advantage of Model 2 (MVC) Architecture

  • Navigation control is centralized Now just controller contains the logic to decide the following page.
  • Easy to maintain
  • Easy to extend
  • Easy to test
  • Better partition of concerns

Disadvantage of Model 2 (MVC) Architecture

  • We need to compose the controller code self. On the off chance that we change the controller code, we have to recompile the class and redeploy the application.






javacodegeeks is optimized for learning.© javacodegeeks .
All Right Reserved and you agree to have read and accepted our term and condition