Home  >  Article  >  Java  >  Detailed explanation of the difference between jsp and servlet

Detailed explanation of the difference between jsp and servlet

藏色散人
藏色散人Original
2020-02-18 10:04:2114521browse

Detailed explanation of the difference between jsp and servlet

Detailed explanation of the difference between jsp and servlet

The differences between jsp and servlet are as follows:

Jsp is a simplification of Servlet. Using Jsp only needs to complete the content that the programmer needs to output to the client. How to embed the Java script in Jsp into a class is completed by the Jsp container.

Recommended: "Java Learning"

1. jsp becomes a Servlet after compilation.

2. JSP is better at page display, and servlet is better at logic control.

3. There are no built-in objects in Servlet. The built-in objects in Jsp must be obtained through the HttpServletResponse object and the HttpServlet object.

4. Servlet is a complete Java class. The Service method of this class is used to generate a response to the client.

Detailed explanation of the difference between jsp and servlet

Extended information:

The difference between Servlet and JSP:

1. The application logic of Servlet is in the Java file, and Completely separated from the HTML in the presentation layer.

2. In the case of JSP, Java and HTML can be combined into a file with a .jsp extension.

3. JSP focuses on views, and Servlet is mainly used for control logic.

4. Servlet is more like a Controller, used for control.

For more programming related content, please pay attention to the Programming Tutorial column on the php Chinese website!

The above is the detailed content of Detailed explanation of the difference between jsp and servlet. 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