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