This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trying to access a session scoped bean in another bean which has application scope

 
Vineet kumar Gupta
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if the scope of loginbean is session then it should not be null...


pw.println("hello"+cont.getExternalContext().getSessionMap().get("loginbean"));
but it is showing hello null
....anyone help ???
 
Vineet kumar Gupta
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to access the session scoped bean named "loginbean" into another bean ...how can i do it ???
 
Vineet kumar Gupta
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but if i do like that


pw.println("hello"+cont.getExternalContext().getSessionMap().get("validbean"));

here validbean is a bean which have application scope/session scope ...means i am trying to access loginbean into validbean...

.
what is the location where l can get the loginbean ....??? getsessionmap() is not containing that

someone please help
 
Ravi Choudhary
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi Vineet,



Hope above code will work for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic