Cookies were originally developed to solve the problem of keeping session context using HTTP.
Cookies consist of a server sending some information, a "cookie", for a client to store locally, and on future requests to that server, the client sends back the cookie information via HTTP headers.
Assuming the client's software supports cookies, the whole process requires no user interactions and is an ideal tool for keeping session context.
Due to the nature of cookies, they can be used to snoop, to a limited extent, on a client's browsing habits. For the most part cookie abuse is not a problem, but because of the issue, most browsers allow cookies to be disabled.
Cookies are name/value pairs that in HTTP are exchanged via two headers: Set-Cookie and Cookie. Set-Cookie goes from the server to the client, and Cookie from client to server.
The Set-Cookie header is sent once when the session is first established. Cookies have a time-out, and a client keeps a copy of the cookie's value until that time-out expires.
Let's try the following code
Content of index.jsp
Content of main.jsp
Content of other1.jsp
Content of other2.jsp
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.