Home  >  Article  >  Java  >  What is the essence of jsp page?

What is the essence of jsp page?

little bottle
little bottleOriginal
2019-05-23 14:34:207063browse

The essence of a JSP page is a servlet; the JSP page is compiled into a Servlet by the system, and the Servlet responds to user requests. JSP can achieve page effects by outputting html static pages in the servlet output stream; each page is generally the same, except that the content displayed on the page and the page layout are different.

What is the essence of jsp page?

The full name of JSP is Java Server Pages, and its Chinese name is java server page. It is basically a simplified Servlet design

The essence of JSP is servlet (a special java class).

A JSP page is a regular Web page with JSP elements. It is composed of static content and dynamic content.

Among them, static content refers to HTML elements, and dynamic content (JSP elements) includes instruction elements, script elements, action elements, comments, etc.

JSP can achieve page effects by outputting html static pages in the servlet output stream. In fact, each page is roughly the same, but the content displayed on the page and the page layout are different.

JSP embeds java code in standard html so that the static part does not need to be controlled by the java program, and can flexibly control the dynamic output content.

On the surface, JSP pages no longer require Java classes, but in fact JSP is an instance of Servlet.

The JSP page is compiled into a Servlet by the system, and the Servlet responds to user requests.

JSP can only be effective in Web applications. In Web applications, each JSP will generate a corresponding Servlet in the Servlet container.

For example, in Tomcat, find test_jsp.java and test_jsp.class in Tomcat's work\Catalina\localhost\test001 (project name)\org\apache\jsp directory (take test.jsp as an example) document.

This Java class mainly contains three methods (remove the _jsp prefix and lowercase the first letter)

init()

destory()

service()

The above is the detailed content of What is the essence of jsp page?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn