Comparison between servlet and JSP
1. The servlet is loaded by the web server. The web server must contain the JVM that supports servlet. The nature of the servlet is that the JAVA application running on the server side.
2. JSP (java server page) is also a web component executed on the server. It separates the webpage logic from the display of the webpage design. Jsp is a dynamic page technology. The main purpose is to separate the representation logic from the servlet.
3. JSP is a scripting language. JSP provides a set of simple tags that are better integrated with HTML. By extending JSP tags, JSP provides the ability to dynamically execute webpages. It is an embedded scripting language, essentially, java code is embedded in HTML code.
4. servlet can implement all the functions of JSP. However, it is very difficult for the artist to use servlet for the interface. Later, JSP was developed. In essence, it is Servlet. The predecessor of JSP is servlet.
5. The difference between the two is that the development interface can be directly written in JSP.
For example, write a table label in JSP.
[Data]
In servlet, you need to write: out. println ("
[Data]
");
6. JSP files have become servlet files after being called by the Application Server (such as tomcat, weblogic, websphere, and resin, that is to say, the servlet File is displayed on the web page. The servlet File generated after the JSP file under Tomcat is compiled is placed in the work folder. The HTML code in JSP is out in servlet, And the jsp code is placed in different places according to the tag.
7. java code is embedded in jsp, while HTML code is embedded in servlet.