Web tier: servlets, JSP, Web frameworks: How do I access JavaBean instanciated in JSP from another Class
How do I access a JavaBean that already has been instanciated (with scope session) in an JSP page? I know how to do this from a JSP but how do I do this from another Class or Bean within the web application?
- Posted by: Elmar Schmidt
- Posted on: July 27 2004 03:25 EDT
Thanks in advance for any suggestions,
- How do I access JavaBean instanciated in JSP from another Class by Rene Zanner on July 28 2004 06:27 EDT
If you have a reference to the HttpSession called "session" in your class, you can simply call
[Bean-Type] bean = ([Bean-Type]) session.getAttribute("[Bean-ID]");