I have a SessionScoped ManagedBean. I want to reset all value of this bean. I'm using JSF 2.1.0-b03
@ManagedBean(name = "myBean")
@SessionScoped
public class MyBean implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
}
Now, I've the method, which resets all value to null. But I don't like this solution.
private void unboundValue() {
name= null;
}
How can I unbound value from SessionScoped ManagedBean?
Manual reset seems the proper way. If you want to invalidate the whole session, not just one bean, then call session.invalidate()
. If it's just one bean, the manual field reset is ok.