Web application state Management (top)

Source: Internet
Author: User

One: Overview
The HTTP protocol uses a stateless connection: the client browser establishes a connection with the server-making a request-getting
Response-Closes the connection. In other words, the connection is only for one request/response. Because connections are not persisted
Therefore, the container does not recognize whether the customer who made the second request is the same person as the customer who made the previous request.
For a container, each request comes from a new customer.
There are 4 ways to solve this problem in Web programming.
Method One: Form hidden fields
<input type= ' hidden ' name= ' session ' value= ' session/>
The contents of the entry form indicate that the specified name and value will be included in the Get and post data when the form is submitted
, hidden fields do not affect the outside of the page that is rendered to the user, instead, they can store fixed
The fixed name and value of the service, regardless of user input.
Purpose of hidden fields: 1. Session tracking for user access on the Web 2. Providing server-side programs
Pre-defined input 3. Store dynamic page context information.
Cons: Only valid if each page is dynamically generated.
Method Two: Cookies
A cookie is a short text message sent by the Web server to the client's browser for the first visit to
When you access the same Web site or domain, the browser returns the text information without changes. By making
When the server reads information that was previously sent to the client, the Web application can provide visitors with many
, Cons: involves some sensitive privacy information.
Method Three: URL rewriting
Reason: Resolving cookies
The client appends some extra data to each URL address that identifies the session at the end of the server in that identity
association with the data stored on the session
Method Four: Session
The object that the server creates and maintains for the client to hold the customer state data, which is stored in the
Server, the session object remains in the user's state during a continuous interaction between the client and
Until the end of the interaction process.

Web application state Management (top)

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.