Just read the article today, the general meaning is that G elder brother and other sites put a lot of things stored in the session cookie, can reduce the burden of various servers. Then I found my memory of the request to application a little blurred, which is on the server, which is the client, back and forth to read so convenient and what to do with Ajax? Sparked a thought of me. In fact, when learning too focused on practical, too much attention to the implementation of the project function, some concepts but did not really understand, it seems to learn good, is too much pit. This really can not blame me, floating for so long, to this age only want to fast and stable down, inevitably some impatient.
By convention, the first paragraph is over.
If the request is on the client, then how to have the GetSession method? If the browser is not on the client, it should not be read in the request when it is passed to parameter. So the request must be in the client, but the meaning of this client is still to be re-understood, it should be said from the client, in the server read, so the client is still invisible, so the El expression can read, and JS cannot read. This means that each time a request is initiated, a call is sent, a cookie is attached, and the session and application are resident services, so in the same reply, request,session,application can communicate freely with each other. It's not that you can communicate with clients and servers at will, everything happens on the server, and then the response generates html,html is the real client. Ajax is the JS level of things, belonging to the HTML, so is also the client browser category. In each script, the number of El expression is the most special, he is actually in the server-side compiled execution, so can read the request, that is, in return to the browser when the El expression is not visible, only see the results. When using the request to save data from the server, it is the meaning of this time to generate HTML with this data, on the JSP servers, everything is in the response output stream out to complete, when this process occurs, the life cycle of the request is over, So the request essentially does not store any data for you, and all of the javabean that are transmitted with the request can actually be replaced with more than one field on the servlet, and there is no transfer process, is it? Do not forget that there is a request redirection mechanism, which can be passed at a level. This is the true meaning of the request. A layer of data from the servlet is set to the same request object, which is eventually reflected in the response output stream by the El expression. The session and application seem to be out of the discussion, even if you can call the JDK jar package, not to mention the two things.
So, the question is back, if we put things in a lot of cookies, it is bound to send a large amount of data each request, and has a repetition, as long as not to clear the cookie, each time will be the same data more than once, so it is not as direct as the session life cycle to shorten a point.
Does saving in cookies improve performance?