0% found this document useful (0 votes)
62 views6 pages

Model 1 and Model 2 (MVC) Architecture

There are two main architectures for developing web applications: Model 1 and Model 2 (MVC). Model 1 uses servlets and JSPs with business logic and presentation mixed together, while Model 2 (MVC) separates the model, view, and controller layers for better maintenance and extensibility. The MVC pattern divides the application into three modules: the model for data and logic, the view for display, and the controller to intercept requests and direct input/output between model and view.

Uploaded by

shubham gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views6 pages

Model 1 and Model 2 (MVC) Architecture

There are two main architectures for developing web applications: Model 1 and Model 2 (MVC). Model 1 uses servlets and JSPs with business logic and presentation mixed together, while Model 2 (MVC) separates the model, view, and controller layers for better maintenance and extensibility. The MVC pattern divides the application into three modules: the model for data and logic, the view for display, and the controller to intercept requests and direct input/output between model and view.

Uploaded by

shubham gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Model 1 and Model 2 (MVC) Architecture

Before developing the web applications, we need to have idea about design
models. There are two types of programming models (design models)
Model 1 Architecture
Model 2 (MVC) Architecture

Model 1 Architecture
Servlet and JSP are the main technologies to develop the web applications.
Servlet was considered superior to CGI. Servlet technology doesn't create
process, rather it creates thread to handle request. The advantage of
creating thread over process is that it doesn't allocate separate memory
area. Thus many subsequent requests can be easily handled by servlet.
Problem in Servlet technology Servlet needs to recompile if any designing
code is modified. It doesn't provide separation of concern. Presentation
and Business logic are mixed up.
JSP overcomes almost all the problems of Servlet. It provides better
separation of concern, now presentation and business logic can be easily
separated. You don't need to redeploy the application if JSP page is
modified. JSP provides support to develop web application using JavaBean,
custom tags and JSTL so that we can put the business logic separate from
our JSP that will be easier to test and debug.
As you can see in the above figure, there is picture which show the flow of the
model1 architecture.
Browser sends request for the JSP page
JSP accesses Java Bean and invokes business logic
Java Bean connects to the database and get/save data
Response is sent to the browser which is generated by JSP

Advantage of Model 1 Architecture


Easy and Quick to develop web application
Disadvantage of Model 1 Architecture
Navigation control is decentralized since every page contains the logic to
determine the next page. If JSP page name is changed that is referred by other
pages, we need to change it in all the pages that leads to the maintenance
problem.
Time consuming You need to spend more time to develop custom tags in JSP. So
that we don't need to use scriptlet tag.
Hard to extend It is better for small applications but not for large applications.
Model 2 (MVC) Architecture
Model 2 is based on the MVC (Model View Controller) design pattern. The MVC
design pattern consists of three modules model, view and controller.
Model The model represents the state (data) and business logic of the
application.
View The view module is responsible to display data i.e. it represents the
presentation.
Controller The controller module acts as an interface between view and model.
It intercepts all the requests i.e. receives input and commands to Model / View
to change accordingly.
Advantage of Model 2 (MVC) Architecture
Navigation control is centralized Now only controller contains the logic to
determine the next page.
Easy to maintain
Easy to extend
Easy to test
Better separation of concerns
Disadvantage of Model 2 (MVC) Architecture
We need to write the controller code self. If we change the controller code,
we need to recompile the class and redeploy the application.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy