Wednesday, 21 August 2013

primefaces session map attribute can not get in page

primefaces session map attribute can not get in page

I set an attribute in session map on my primefaces project. I can not get
my values in js of my Facelets page.
I upload the file in a.xhtml page and set the path values in sessionmap
and get it in a.xhtml after upload finish.
FacesContext.getCurrentInstance().getExternalContext().getSessionMap()
.put("tmpfilepath", realPath+"images"+File.separator+"tmp.jpg");
Its output is my values. Then I get the values after this step on my page
alert("#{facesContext.externalContext.sessionMap.containsKey('tmpfilepath')}");
alert("#{facesContext.externalContext.sessionMap.get('tmpfilepath')}");
Its output is false and null.

No comments:

Post a Comment