Overview of Servlet and JSP pages

Source: Internet
Author: User

When sending a client request, call the service method and pass a request and response object. Servlet first checks whether the request is a get operation or a post operation. Then it calls the following method: doget or dopost. Both doget and dopost accept requests (httpservletrequest) and responses (httpservletresponse ).

Servlets is a Java class that can use print statements to generate dynamic HTML content. However, it must be mentioned that servlets runs in a container and APIs manages the session and object lifecycle. Therefore, when using Servlets, you can gain all the advantages of the Java platform, including sandbox (Security), database access API through JDBC, and Server Load balancer with cross-platform portability.

JSP pages are actually web pages with traditional HTML and Java code. When calling a JSP page, it is first compiled into a Java Servlet (through the JSP engine. In this case, the servlet engine processes the servlet just like any other servlet. Then, the servlet engine loads the servlet class (using the Class Loader) and executes it to create dynamic HTML and send it to the browser, as shown in 1. The servlet creates all required objects, writes all objects to the output stream as strings, and displays them in the browser.

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.