JSP Architecture, JSP Model 1 architecture, JSP Model 2 architecture


 

JSP Architecture, JSP Model 1 architecture, JSP Model 2 architecture

In this tutorial we are discussing JSP Model 1 and JSP Model 2 architecture.

In this tutorial we are discussing JSP Model 1 and JSP Model 2 architecture.

JSP Architecture

In this section we are discussing JSP Architecture and types of JSP Architectures. JSP is simply html pages with the jsp extension. In the JSP page programmers embeds Java code for generating dynamic content.

JSP is mainly used to develop the view for web applications. Sometimes it also used for business logic, But in majority of cased it is used to create the different types of view for the applications. We the help of JSP you can create data entry forms, reports, dynamic pages to display some information top the user.

JSP Architecture

While developing the web applications two types of the architecture is used. These architectures are known as Model 1 and Model 2 architectures. So, in JSP there are two types of architecture of the JSP:

  1. Model 1 Architecture
  2. Model 2 Architecture

JSP Model 1 Architecture

In case of Model 1 architecture the request is processed by JSP or Servlet. The JSP or Servlet handles all the responsibility of request processing such as validating the data, business logic validation and processing, show error messages, finally generating the view for the application.

JSP Model 1 architecture is good for very small application, but it's not a good solution for big enterprise application. The JSP Model 1 architecture do not separate the view, business processing logic and the view is tightly integrated with the business logics.

Here is the diagram of JSP Model 1 architecture:

JSP Model 1 architecture

JSP Model 2 architecture

The JSP Model 2 architecture is based on the popular MVC architecture. Here Model, View and Controller is responsible for specific work for making the architecture ideal for developing complex enterprise web applications.

In JSP Model 2 architecture JSP is used for creating the view for the application. A centralized Servlet is used to handle all the request for the application. The Servlet works as the controller for the application. It then uses the Java beans for processing the business logic and getting the data (Model) from the database. Finally it uses the JSP to render the view which is displayed to the user.

Here is the diagram of JSP Model 2 architecture:

JSP Model 2 architecture

The MVC architecture is very popular architecture and there are many frameworks available for developing Java based web applications. MVC based frameworks are:

In this we have understood the architecture of JSP.

Ads