1.jsp is compiled into a servlet. (JSP is the essence of SERVLET,JVM can only identify Java classes, not recognize the JSP code, the Web container to the JSP code into the Java class can be recognized)
The 2.jsp is better at showing on the page, and the servlet is better at logic control.
There are no built-in objects in 3.Servlet, and built-in objects in the JSP must be obtained by HttpServletRequest objects, HttpServletResponse objects, and HttpServlet objects.
JSP is a simplification of the servlet, using JSP only to complete the programmer needs to output to the client content, JSP Java script How to mosaic into a class, completed by the JSP container. The servlet is a complete Java class, and the service method of this class is used to generate a response to the client.
Teacher's Answer 1:
JSP is essentially a servlet, but the two are created differently. A servlet is a completely Java program code that is adept at process control and transaction processing through the servlet
To generate dynamic Web pages; JSP is composed of HTML code and JSP tag, can easily write dynamic Web pages
In practice, the servlet is used to control the business process, and JSP is used to generate dynamic Web pages. In the struts framework, the JSP is in the view layer of the MVC design pattern, and the servlet is at the control layer.
Answer 2:
JSP is an extension of the servlet technology, which is essentially a simple way of servlet. JSP is compiled "class servlet". The main difference between servlet and JSP is that the application logic of the servlet is in the Java file and is completely detached from the HTML in the presentation layer. In the case of JSP, Java and HTML can be combined into a file with a. jsp extension. The JSP focuses on the view, and the servlet is used primarily for control logic.