JSP and Servlet

Source: Internet
Author: User
Generally, JSP runs in the following way: when the server is started and the web browser sends a page request, the web server first determines whether the request is a JSP page request. If this page is only a common html/XML page request CodeTo the web browser. Compile the servlet code, convert it into a bytecode (. Class) file, call the Java Virtual Machine to execute the bytecode file, and then pass the execution result to the Web browser. If the JSP page is not requested for the first time and has not been modified, the JSP Engine directly calls the Java Virtual Machine to execute the compiled bytecode. class file, and then transfer the result to the Web browser. Below is a JSP running:

From this, we can see the relationship between JSP and Servlet. the JSP Engine is responsible for translating JSP pages into servlet. Therefore, JSP at the underlying layer is completely servlet (refers to the original concept servlet, instead of httpservlet ). As mentioned above, JSP programming corresponds to javax. servlet. JSP, more specifically, this package is used by the JSP Engine and needs to be used for translation, we do not need to use this package when writing JSP pages.

Why is it necessary to implement a JSP at the high-level level with Servlet? This problem is related to the complexity of servlet compilation. If you use servlet to control the page appearance, it will be a headache, using JSP, we handed over complicated printing tasks to the JSP Engine,ProgramMembers can focus on logical control.

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.