Model 1 and Model 2 (MVC) Architecture
Before building up the web applications, we need thought regarding configuration models. There are two kinds of programming models (structure models)
- Model 1 Architecture
- Model 2 (MVC) Architecture
Model 1 Architecture
Servlet and JSP are the fundamental 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 rationale are blended up.
JSP defeats practically every one of the issues of Servlet. It gives better partition of concern, presently introduction and business rationale 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 rationale separate from our JSP that will be simpler to test and investigate.>
As you can find in the above figure, there is picture which demonstrate the progression of the model1 architecture.
- Browser sends demand for the JSP page
- JSP gets to Java Bean and summons business logic
- Java Bean associates with the database and get/spare data
- 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 rationale 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 configuration design comprises of three modules model, see and controller.
Model The model speaks to the state (information) and business rationale of the application.
View The view module is mindful to show information for example it speaks 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 accordingly.
Advantage of Model 2 (MVC) Architecture
- Navigation control is centralized Now just controller contains the rationale 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.