Right-click on the session package, this time click on New…, and select the JSF Managed Bean option again.
Note
Did you notice that NetBeans remembers the menu options you chose recently and moves them to the top of the options list? NetBeans is fantastic.
Name the class as CurrentTheme
and change Scope to Session. The source code is once again opened automatically for us and it looks like this:
package com.andyba.pfthemes.session; */ import java.io.Serializable; import javax.inject.Named; import javax.enterprise.context.SessionScoped; /** * * @author Andy_2 */ @ManagedBean @SessionScoped public class CurrentTheme implements Serializable { /** * Creates a new instance of CurrentTheme */ public CurrentTheme() { } }
There is a new annotation, @SessionScoped
, which needs to be explained now:
@SessionScoped
: A session-scoped Bean is one that is created each time a user visits the application for the first time and lives for as long as the user session...