Home > Article > Web Front-end > The difference and connection between servlet and jsp
(1) Servlet is a server-side Java application that is independent of platform and protocol and can generate dynamic Web pages. .
(2) It acts as the middle layer between client requests (web browsers or other HTTP client programs) and server responses (databases or applications on HTTP servers).
(1) The full name of JSP is Java Server Pages, and the Chinese name is java server page. It is basically a simplified Servlet design. It [1] was developed by Sun A dynamic web technology standard initiated by Microsystems and established by many companies.
(1) jsp is an advanced encapsulation of servlet. The essence is still servlet.
When the jsp page is loaded for the first time, a java file will be generated, compiled into a .class file in the virtual machine, and finally loaded and initialized into a servlet.
(1) servlet dynamically generates an html page through httpservletresponse in java code
(2 ) jsp generates a dynamic html page by embedding java code into html
(one is to write html in java, the other is to write java code in html)
(1) When we use servlet to generate dynamic pages, it will be very complicated. Because you need to write html statements in out.println(). But servlets are particularly good at handling front-end and back-end data interaction.
(2) Therefore, at this time we introduce jsp technology to replace the function of servlet to generate html. Let serlvet only focus on the interaction between the front-end page and the background data. This also implements the idea of mvc.
The above is the detailed content of The difference and connection between servlet and jsp. For more information, please follow other related articles on the PHP Chinese website!