Redian新闻
>
java servlet httpsession问题求教
avatar
java servlet httpsession问题求教# Java - 爪哇娇娃
s*y
1
请问打开一个browser 是不是就算一个新的session叻
HttpSession session = response.getSession();
上面这条语句是不是每次打开一个新的browser就会生成一个
新的session, 而不能得到以前browser的信息?
有否可能 打开新的browser还是当前的session呢?
谢谢
avatar
m*t
2

Usually, yes.

【在 s*******y 的大作中提到】
: 请问打开一个browser 是不是就算一个新的session叻
: HttpSession session = response.getSession();
: 上面这条语句是不是每次打开一个新的browser就会生成一个
: 新的session, 而不能得到以前browser的信息?
: 有否可能 打开新的browser还是当前的session呢?
: 谢谢

avatar
w*t
3

^^^^^^^^^^^^^^^^^^
if you open your new browser by "ctl-N" - then it's same session,
o/w, you're right

【在 m******t 的大作中提到】
:
: Usually, yes.

avatar
g*g
4
You can't, but you may use cookie to store some information that interests
you. Such as the user profile.

【在 s*******y 的大作中提到】
: 请问打开一个browser 是不是就算一个新的session叻
: HttpSession session = response.getSession();
: 上面这条语句是不是每次打开一个新的browser就会生成一个
: 新的session, 而不能得到以前browser的信息?
: 有否可能 打开新的browser还是当前的session呢?
: 谢谢

avatar
w*t
5
his question is not that clear. if all he want to achieve is to make info
available for multiple sessions, try to save the info in app / context level.
(which makes me suspect that if that's really what he want, or maybe a
misunderstanding of the requirements?)

【在 g*****g 的大作中提到】
: You can't, but you may use cookie to store some information that interests
: you. Such as the user profile.

avatar
m*t
6

level.
IIUC, what he wants is something like the "Remember Me" thing on the login
screen we typically see. 8-) That can done by setting a persistent cookie.

【在 w******t 的大作中提到】
: his question is not that clear. if all he want to achieve is to make info
: available for multiple sessions, try to save the info in app / context level.
: (which makes me suspect that if that's really what he want, or maybe a
: misunderstanding of the requirements?)

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。