Architecture of JSP:
There were primarily two types of architecture based on the JSP functionality and its improvement in the further days of its development. With the above criteria we have two types of architecture as below:
- Model Type 1 of Architecture
- Model Type 2 of Architecture
Model 1 type of Architecture:
- The processing of files like the incoming request and replying back to the request which in earlier stages was mainly controlled by the JSP file alone.
- The main pros of this type of architecture were it was simple, compact and there was an easy separation of presentation of matter and the details in the content.
- But this type faced its worst nightmare when the design of the project goes complex implementations.
- This was easy for the maintenance of JSP developers but for other design and patterns this was seems to be a tough issue.
- And this type of architecture was named as Model 1 type of architecture.
Model 2 type of Architecture:
- This model 2 type of architecture was named as “Hybrid architecture”.
- In this type we use both servlet and JSP, where the servlet acts as an in charge or controller and is in charge of the request processing and the creation of any beans or objects used by the JSP, as well as deciding, depending on the user’s actions, which JSP page to forward the request.
- In here, there was decided that there will not be any processing logic in the JSP page.
- It is simply responsible for retrieving any objects or beans that may have been previously created by the servlet, and extracting the dynamic content from that servlet for insertion within static templates.
- This was most widely used everywhere because of the strengths of both the JSP for presentation layer and the servlet for performing intense process tasks.
- Here we have the cleanest separation of presentation from content, leading to clear delineation of the roles and responsibilities of the developers and page designers on your programming team.
- The JSP container is responsible for intercepting requests for JSP pages. This tutorial makes use of Apache which has built-in JSP container to support JSP pages development.