ServletIs a server-side Java application.ProgramIs independent of platform and protocol and can generate dynamic web pages.It serves as the intermediate layer between customer requests (Web browsers or other HTTP client programs) and server responses (databases or applications on the HTTP server. Servlet is a Java application on the server inside the Web server. Unlike the traditional Java application started from the command line, servlet is loaded by the Web server, the Web server must contain a Java virtual machine that supports servlet.
Assumerver pages (JSP)It is a technology that implements mixed coding of common static html and dynamic HTML,JSP does not add any functions that cannot be implemented by Servlet in essence.
However, it is more convenient to write static HTML in JSP, So you no longer need to use the println statement to output each line of HTMLCode. More importantly, with the separation of content and appearance, different types of tasks in page creation can be easily separated: for example, HTML design is performed by page designers, at the same time, it also sets aside space for servlet programmers to insert dynamic content.