2

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;

|

2 Comments


We can also get managed bean from session map

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


This is really an interesting topic. Congratulations to the writer. I'm sure a lot of readers having fun reading your post. Hoping to read more post from you in the future. Thank you and God bless!


Rica
www.imarksweb.org

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