Simple comparison of HTML and JSP

1. Preliminary understanding

HTML (HyperText Markup Language) hypertext markup language : it is a static page , and it is an interpreted language like JavaScript . It can be executed directly , as long as there is a browser, it can be displayed normally, without specifying the compilation tool, just write HTML tags in the txt document.

JSP (Java Server Pages) Java server page: It is the same as the servo technology, which is a technology defined by SUN company for developing dynamic web resources, that is, dynamic pages , which cannot be directly executed . The execution process: If this is the first time to access the jsp file, the jsp file will be translated into a corresponding .Java file (sevlet) by the server, and then the .java file is compiled into a .class file and loaded into memory, and finally carried out transfer. When accessing the jsp file again, the process of translation and compilation will be skipped, and the jsp instance in memory will be directly called, so the subsequent jsp access speed will be faster than before.

Second, the simple difference

1, JSP dynamic pages need to be converted into a servlet it is running, it must publish to Tomact and other server on to run. And html static pages can be run directly

2. Java code can be written in jsp (the Java code block of JSP is also called JSP script). Java code is enclosed in <%%>. And it is impossible to write java in html

3, the header is not the same: JSP table contains header have "<% @ Page Language = " Java "  and = Import" Classes in java.util * "the pageEncoding =" UTF-. 8 "%.>. HTML no

3. Comparison of advantages and disadvantages

 

advantage

Disadvantages

html

During the development process, the front end and the back end are separated, and the interaction is realized by JSON transmission

Cannot display java entity class object directly, need to convert to json format

Stronger cross-platform capabilities, relying on browser support

Difficult to develop, you need to consider browser compatibility; too many page requests

Enable back-end data interface to be reused

Interface code needs to be added a lot

jsp

Dynamic information; reduce the number of requests; security; do not consider browser compatibility;

Increased the pressure on the server; the front end and the back end are not separated, slowing the development progress;

Multi-platform support: can be developed, deployed, and expanded in any environment (Java language features); support write once, run everywhere

Too much reliance on java runtime environment

Published 77 original articles · 100 likes · 70,000+ views

Guess you like

Origin blog.csdn.net/super_DuoLa/article/details/103163484