Today, I have been depressed by the session value when writing code for a long time. I have been trying to make the adminid value available throughout the JSP page, but I have been using the request. setattribute (), so it has not been solved, so I have paid a lot of effort to get this value. After reading the book, I found that the original request was used. getsession (). setattribute (), so that the value of adminid can be transmitted throughout the process. Here we will introduce the differences between the two. I hope you will be helpful ,.
Request. getsession (). setattribute ("adminid", adminform. getadminid () sets adminform. the returned value of getadminid () is saved to the current session of the session and the name is adminid. As long as the current session does not expire, it can be accessed anywhere. Request. setattribute ("adminid", adminform. getadminid () sets adminform. the return value of getadminid () is saved to the current request. The value is adminid and can only be accessed in the current request.
Cannot access
The request. setattribute life cycle is at the request level.
The life cycle of request. getsession (). setattribute is session-level.