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.
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!