开发者

Definition and practical meaning of @SessionScoped

I would like to understand the full meaning of the @SessionScoped annotation in a JSF ManagedBean.

I guess it is related to the http session, but still, it's not very clear to m开发者_StackOverflow社区e when it starts, when it ends and if it can be interrupted.

  • If I leave a browser open, without activity, during 2 hours. Is the session still open?
  • Is a session shared across browser tabs
  • Does a session behave identical in say Firefox, IE or Safari?
  • ...


  1. no, the session times-out if there is no activity
  2. yes, the session is shared across browser tabs
  3. yes, the session is a server-side notion mainly, browsers only send a cookie to identify

The session starts when the user requests the first page.

The @PostConstruct method of session scoped beans (if exists) is invoked when you first access a page that references that bean (I'm not entirely sure in this, though)

The session ends when you call session.invalidate() or when it times-out (the timeout period if configurable in web.xml). Then the @PreDestroy method (if exists) is invoked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜