1

How-to get or remove a jsf backing bean from session?

To reset session bean

FacesContext
.getCurrentInstance()
.getApplication()
.createValueBinding( "#{yourBeanName}").setValue(FacesContext.getCurrentInstance(), null );



To get session bean reference

Object obj = FacesContext
.getCurrentInstance()
.getApplication()
.createValueBinding("#{yourBeanName}")
.getValue(FacesContext.getCurrentInstance());
 
YourSessionBean bean = (YourSessionBean)obj;

|

1 Comments


We can also get managed bean from session map

Object obj = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("name of your managed bean")

Copyright © 2009 So That I Can Remember All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive.