Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JSP Structure

JSP Structure

A web server needs a JSP engine, that is, a container, to process JSP pages. The container is responsible for intercepting requests for JSP pages. This tutorial uses Apache with an embedded JSP container to support JSP development.

The JSP container works together with the Web server to provide the necessary runtime environment and other services for JSP to run properly, and it can correctly identify the special elements that belong to JSP pages.

The figure below shows where the JSP container and JSP files are located in a Web application.


JSP Processing

The following steps show how a Web server uses JSP to create web pages:

The steps mentioned above can be represented by the following figure:

In general, the JSP engine checks whether the Servlet corresponding to the JSP file already exists and whether the JSP file's modification date is earlier than the Servlet's. If the JSP file's modification date is earlier than the corresponding Servlet, the container can determine that the JSP file has not been modified and the Servlet is valid. This makes the whole process more efficient and faster compared with other scripting languages (such as PHP).

In summary, JSP pages are just another way to write Servlets without having to become a Java programming expert. Apart from the interpretation phase, a JSP page can be treated almost as an ordinary Servlet.