• Post Reply Bookmark Topic Watch Topic
  • New Topic

session scope  RSS feed

 
Yellapa Adepu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys..
How does a session scope work a JSF backing beans... I made one bean's scope as request and inside keep some values in session map. the problems is I am able to retrieve only few of them from session map; some of them are coming as null ... can anybody please expalin how to overcome the problem

thanks
-Adepu
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does a session scope work a JSF backing beans

The same way it works in any J2EE app. The mechanism for placing objects in Session are just a bit different.

I made one bean's scope as request and inside keep some values in session map

How are you putting values into the session?
 
Yellapa Adepu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am keeping as below
getSessionMap().put("editRemndrId", editRemndrId); where editRemndrId is a String type.

When I try to retrieve using (String)getSessionMap().get("editRemndrId") I am getting it as a null. But other variable with same logic, I am able retrive.

Thanks
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not aware of a getSessionMap method in the JSF API. Where does this method exist? Is it something you wrote? If so, can I see that method? That might give some clues.
 
Yellapa Adepu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yah.. we have own method as
protected Map getSessionMap() {
return getFacesContext().getExternalContext().getSessionMap();
}
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Adepu:
Yah.. we have own method as
protected Map getSessionMap() {
return getFacesContext().getExternalContext().getSessionMap();
}


You don't want to get the sessionMap, you want to get the session. The sessionMap is an implementation of java.util.Map.

Also,

We don't have too many rules around here but we do have a Naming Policy. Please adjust your display name accordingly. You can do so by clicking here.

Thanks a bunch.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Adepu",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!