Cookies in the JSP

Source: Internet
Author: User
Tags array
Cookie|js

1. Browsers generally only allow 300 cookies, each site has a maximum of 20 cookies, each cookie size is limited to 4KB.
2. The contents of cookies are mainly: name, value, time, domain, path.
If the cookie is not set to time, it is only alive during the browser session, called the session cookie
Session cookies are generally stored in memory, not on the hard disk, and the general cookie is stored on the hard disk.
3. Reading cookies from the client is generally 2 steps:
A. Call request. GetCookies () gets an array;
B. Iterate the array, using the GetName () of each cookie to find the cookie that is interesting.
4. If the request does not contain a cookie, the array returned by getcookies is null.
5. SetPath () The path specified must include the current page
GetPath ()
If you want to specify that the cookie applies to all URLs on your site, use Cookie.setpath ("/").
6. Session Cookies and persistent cookies
The former is only present in the current browser and the latter can be saved for use at the next browser startup



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.