The @ViewScoped has been introduced by JSF 2.0 specification. In a nutshell the data which is @ViewScoped will keep living as long as you don’t navigate to another pagee to itself. The view scope is very convenient, since it allows the pattern of initializing data when you first access a page (via a non-faces request, which is typically a GET request) and then keep that data when you work on the page, doing postbacks, AJAX requests, etc.
In this tutorial we will compare the available options for storing Object data into a Web application, showing at first the core JSF 2 scopes and the extension provided by CDI. Core JSF scopes JSF 2.0 specification defines the following scope scopes for storing data: @RequestScoped @ViewScoped @SessionScoped @ApplicationScoped @CustomScope Using the Request scope is … Read more