This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
If you have a String object in a session that was put there earlier in an Action object, e.g. session.setAttribute("MyVariable", "MyString"), is it possible to retrieve "MyString" from the session in a non-form bean? I want to use the bean tag on a jsp but don't want to use code in the jsp to send the session to the bean, e.g. myBean.setSession(session).
<a href="http://www.getlocaldeals.com" target="_blank" rel="nofollow">Free local coupons</a>
If you put a bean into the session (as opposed to a string), you can reference it with a <bean:whatever> tag. All you have to do is specify the name and set scope="session".
Although I'm not sure thats what you need.
Joined: Jun 25, 2001
Thanks for the reply. What I wanted to know is: how do I access any object in the session when I am coding a bean? If I have a Customer object stored in the session, how do I access it from a bean? I want to get values from the Customer object for comparison in the bean, then depending on the result, write a message in the jsp with the bean.