Friday, December 06, 2013

JSF 2.x Tip of the Day: How Do I Remove a @ManagedBean ?

A colleague asked me how to remove a @SessionScoped @ManagedBean from a JSF application. We both thought about using the code below, and in fact it works, but it left me feeling that this was too specific.

I thought a better approach would be to just "find" the bean and set it to null. Using an ELResolver I thought would be better since I could just look for a bean in a more general way.


Here are some articles that have some additional ideas. The comment in the first article turns out to be the same method we came up with for removing it from a session.


Popular Posts