I have a session scoped CDI managed bean:
@Named
@SessionScoped
public class SampleBean implements Serializable {
// ...
}
I need to remove this bean from the session after a certain flow for which I used the following code like as seen in this answer:
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
ec.getSessionMap().remove("sampleBean");
However, it does not work and the SampleBean
remains in the session.
Am I missing something?