2017  Kodetalk | Feedback | Privacy Policy | Terms | About

what is @WindowScoped bean in jsf and how to use it?

what is @WindowScoped bean in jsf and how to use it?


@WindowScoped is one of the useful annotation given by JSF from its based scopes as follows,

  • @WindowScoped
  • @ViewAccessScoped
  • @GroupedConversationScoped

"The window-scope is like a session per window. That means the data is bound to a window/tab and it not shared between windows (like the session scope does)."

And use case is very simple, if you dont want to keep the data accross the browser, instead the workable tab or window then go for this scope.

You can use this in a similar fashion how the other scoped annotation used in JSF on your bean or model class.

  1. @WindowScoped
  2. public class MyBean implements Serializable
  3. {
  4. //bean proeprties and methods.
  5. }
Answer is