3 Replies Latest reply on Feb 7, 2008 8:59 AM by Felix Khazin

    Accessing Session bean properties from another bean

    Felix Khazin Newbie


      I'm trying to access a bean's property from another bean. Basically I have this action that gets executed when the user logs in and it stores some information I need that should be accessible by other pages.

      This is simple if I need that information in the View. All I need to do is #{whatever.property}, but I need that property in another bean action. I'm trying to use FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("nameofbean") but I keep getting a class cast exception because the class returned isn't the class of the bean. (My bean has Session scope)

      Anyone have any ideas how I can do this? I've been searching the forum, but I don't see anyone having this problem. I'm surprised because I would thing this would be needed by many people. Perhaps I am doing this incorrectly?

      Thanks for the help,