• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with managed bean

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i'm new here and i'm trying to learn how to develop using j2ee .. i have encountred a problem when using managed beans . the idea was that i'll make one managed bean for each (xhtml) page but the problem is ; i can't access information contained in one managed bean from another ..

it's a simple login then redirection to home page . so can any body give me a hint on how to save the user information during his session and access them from anywhere class i want .

please help
thank you


p.s i'm using jsf 2.0 on glassfish 2.0 server
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yo can acces a session beans from another bean with below code.

MyBean mb = (MyBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("myBean");
 
Ranch Hand
Posts: 90
Eclipse IDE Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kamel

You can use the option of Abdulkerim is very well, but it suppose that your bean must be a Session Scope, I want to give you another option to make the same thing:

Regards
Cesar
 
kamel ben Mbarek
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you guys for your help. i found this solution using annotation :



 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic