Today found a problem, the program in the local run well, packaged to the server, no matter how to add a log, update packaging, and finally there are problems,
Locate the problem step-by-step, and discover that it is a cookie problem.
The service side defines the code that sets the cookie:
public void Setcookie (HttpServletRequest request, httpservletresponse response, String key,string value) {
Cookies, Sessions, and application objects are similar and are collections objects that are used to save data. But the biggest difference between cookies and other objects is that cookies store data on the client's disk, while application and session objects store the data on the server side. Differences in application, section, and cookie objects are shown in the following table:
Object Data Storage Location lifecycle
Application on the Server side
Create cookies with JSP
What is a cookie?
As you know, the browser communicates with the Web server using the HTTP protocol, and when a user makes a page request, the WEB server simply responds, and then closes the connection to the user. So when a request is sent to a Web server, whether it is the first visit or not, the server treats it as if it was the first time, so the bad things can be imagined. To make up for this flaw, Netscape has developed
These are basic knowledge, but it is necessary to have a deep understanding. First, let's give a brief introduction.
Definitions:
When you are browsing the website, the web server will first send a small piece of information to your computer, and the cookie will help you with the text or some choices on the website,
All records are recorded. When you visit the same website next time, the web server will first check whether there is any
What is a Cookie Mapping.
Simply put, a cookie Mapping a cookie that is a user's subordinate to the SSP and is mapped to a cookie attached to the DSP.
Cookie Mapping work requires two data, respectively, the user is subordinate to the SSP side of the
Set and read cookies in servlet display
1. What is Cookie?
Cookie is a message sent to the client by the Web server using the set-Cookie response. The client returns the message to the server in subsequent requests. The server can read (but cannot change) the message.
Cookies are not interpreted and executed in any way. They are displayed as name-value pairs to s
We already know that there is a cookie attribute in the document Object. But what is Cookie? "Some websites store some information on your hard disk with small text files, which are called cookies ." -- MSIE help. In general, Cookies are created by CGI or similar files and programs that are more advanced than HTML, but javascript also provides comprehensive access rights to Cookies.
First, we need to learn
Cookie mechanism: In general, any request made by a browser within the same domain will be brought with a cookie, regardless of the resource requested, and the cookie appears in the cookie field of the request header, if requested. The Set-cookie field of the service-side re
This article introduced the PHP session control, mainly elaborated the following several things:
• Background/concept of Session controlMaintenance and life cycle of • Cookies (effective time)Maintenance and life cycle of session (recovery mechanism)The difference and connection between the • Cookies and the session• Question 1: Why does the session expire after disabling cookies?• Problem 2:ie missing session under browser, each time the page is refreshed, a new sessionid will be generated (no
1. New Cookies:$.cookie (' cookiename ', ' cookievalue ');Note: If you do not set a cookie's validity period, the cookie is called "Session cookie" by default until the browser is closed.Create a cookie and set the validity time to 7 days:$.cookie (' cookiename ', ' Cookieva
The example of this article analyzes the PHP cookie usage. Share to everyone for your reference, specific as follows:
Session Technology: Cookies
Technology that allows server-side scripting to store data in a browser,Allows the server to send instructions to the browser to manage cookie data stored on the browser sideIf the browser stores cookie data stored by
Introduction to asp.net|cookie| Programming
Cookies provide a useful way for a WEB application to save user-related information. For example, when a user visits your site, you can use cookies to save user preferences or other information so that the application can retrieve previously saved information the next time the user visits your site.
This article outlines the application of cookies in asp.net applications, showing you the technical details
Jquery. cookie. js is a jquery-based plug-in, a lightweight cookie plug-in that can read, write, and delete cookies. Next, I will introduce you to the Jquery operation cookie to remember the user name. For more information, see.
1. Introduction to jquery. cookie. js
Jquery. cooki
Delete cookieResponse. Cookies ["cookiename"]. expires = datetime. Now. adddays (-1 );
Use C # To create and read cookies
Use C # To create and read cookies:
1. Create a cookie and write data:
// Create and write cookies
Httpcookie cookie = request. Cookies ["mws_user"];
If (cookie = NULL)
{
Cookie = new httpcookie ("m
1. What are cookies?
As we all know, the browser communicates with the Web server over HTTP. When a user sends a page request, the web server simply responds, close the connection to the user. Therefore, when a request is sent to the Web server, whether it is the first visit or not, the server treats it as the first visit. Such a bad thing can be imagined. To make up for this defect, Netscape has developed an effective cookie tool to store the rec
Cookie, he first appeared in Netscape Navigator 2.0. A cookie is actually a file created by a Web server that stores information on a computer. So why does the Web server create such a file on the client? This is because when the client sends a request to the Web server, such as when it is ready to browse the page, regardless of the client.Whether it is the first visit, the server treats it as the first tim
Note: The filter mainly filters the value inside the request,response.
*web.xml----
* Login Action Add cookie-------
*filter Filter Gets cookies------
(without a new username, password, read the cookie directly through the query database, get user user,
Request.getsession (). setattribute ("user", User1))
* Other action inside get---------
(Duser user= (Duser) request.getsession (). getattribute ("user"),
1, first of all, cookies and the purpose of the session is what.
A: Both are in order to maintain client access to the user and the background server interaction state , the reason for maintaining this state, one is to facilitate the implementation of some business, on the other hand, in order to simplify the backend service design, improve performance.
2, how to understand cookies.
A: I understand that the cookie is used by the server to different
execution of the destruction, to avoid code pollution
Myobj.seti (5); Success
Myobj.seti (101); Failed
Alert (Myobj.geti ());
alert (MYOBJ.I); Error, no this property
So far we have simply implemented the public access and private access rights (also give you want to you, do not give you do not want to give you)
In the page, we usually use the Document.cookie property to access, the new value will create a new cookie, a
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.