[Java] servlet&jsp

Source: Internet
Author: User

Learn servlets and JSPs here >> iAm333 's Column

Books

Xinxin Sun's "servlet/jsp in Depth: Tomcat-based Web development"

Lin Shinliang's "Jsp&servlet Study notes (second edition)"

Process of processing requests by the servlet container

Before starting the text, let's review and refine the process for the servlet container to process the request.

1) The user clicks on a link that points to a servlet instead of a static page.

2) The container "sees" that the request is a servlet, so it creates two objects HttpServletRequest and HttpServletResponse.

3) The container finds the correct servlet based on the URL in the request, creates or assigns a thread to the request, and passes the request and response objects to the servlet thread.

4) The container invokes the Servlet's service () method. Depending on the type of request, the service () method calls the doget () or Dopost ( ) method. This assumes that the Doget () method is called.

5) The Doget () method generates a dynamic page and "plugs" the page into the response object, noting that the container also has a reference to the response object!

6) The end of the thread, the container converts the Response object to an HTTP response, sends it back to the customer, and then deletes the request and response object.

So here's the question: What's the difference between doget () and Dopost ()?

  The difference between 1.doGet and Dopost, when to call, why sometimes dopost to apply Doget
2. The submitted form Method=post executes the dopost, otherwise the goget is executed regardless of whether the method is a post or get execution Dopost methods
3.get: You can pass parameters via URL. Http://www.csdn.net/index.asp?user=1234, Post No.
4. Your form submission has a method, if it is submitted as GET, call the Get method, use post to call the Post method. Get shows the arguments you passed, and the post does not appear.
5. Usual notation: Use Doget () First, then call Doget () in Dopost (), so it's foolproof.
6. Simply put, get is the HTTP header to transmit data, there is a number of restrictions, and post is the HTTP body to transfer data, there is no limit to the number.
7. Another point: The amount of data submitted by Get and post is not the same.
Get seems to be at most only at the URL followed by 64K (?
Post does not seem to have this limit, at least I post over 5M text
There is also a URL refresh when get seems to be able to not repeatedly submit the original submitted data,
And post will say the content has been submitted, want to refresh please submit again.

[Java] servlet&jsp

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.