Comparison between servlet and JSP

Source: Internet
Author: User

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.

Related Article

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.