The difference between JSP Servlets

Source: Internet
Author: User

The main manifestation at two points

1. JSP is a class servlet

JSP simple point is to use another set of simple rules written by the servlet program, it can write Java code, can also write HTML code, JAVASCRIPT,CSS and so on ..., However, the server side is first turned into a servlet program and then executed in the order in which the servlet executes.

JSP is a simplification of servlets, the use of JSP only need to complete the programmer needs to output to the client's content, JSP java script How to mosaic into a class, by the JSP container to complete. The servlet is a complete Java class, and the service method of this class is used to generate a response to the client.

JSPs are essentially servlets, but they are created differently.

Servlet is completely Java program code composition is good at process control and transaction processing and through the servlet to generate dynamic Web pages;

JSP is composed of HTML code and JSP tag, it is convenient to write Dynamic Web page, so we use servlet to control business process in practical application, and use JSP to generate Dynamic Web page. In the struts framework, the JSP is in the view layer of the MVC design pattern, and the servlet is in the control layer .

2, JSP focus on the view, servlet is mainly used for control logic.

The difference between JSP Servlets

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.