I'm using GF4. In my app I have a main menu which is always visible to the user. One of the menu items refers to a @ViewScoped
backing bean, which is being created and its @PostConstruct
method called every time the user clicks on this menu item, which is the expected behavior.
The problem arises when the user clicks on some other menu item, because the @ViewSoped bean continues to exist, i.e. its @PreDestroy
method is not being called.
Looking for an answer I came across this stackoverflow post which proposes setting those two parameters:
com.sun.faces.numberOfViewsInSession
andcom.sun.faces.numberOfLogicalViews
.
Since I want only one @ViewScoped bean at a time I set them both in web.xml to 1
. But this has no effect! Hence my questions:
Is web.xml the right place?
Is there a way to affect the container managed beans, i.e. manually destroy them?
Thanks in advance!