Showing posts with label jsf session bean. Show all posts
Showing posts with label jsf session bean. Show all posts
0

Setting Java Managed Bean into Session

FacesContext.getCurrentInstance().getExternalContext()
               .getSessionMap().put( "testBean",
                     testBean );

TestBean testBean = (TestBean)FacesContext.getCurrentInstance().getExternalContext()
               .getSessionMap().get( "testBean")

|
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;

|

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