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.
Hi all, I have written a custom jsp tag. from JSP page I put some var into session object. and from the same JSP page, I use the custom jsp tag. but how can I use session object from tag handler class that is part of my custom jsp tag.. Thakns.
As I recall, if your tag class extends the TagSupport class, you can do this: HttpSession session = getPageContext().getSession() ; The pageContext carries all of the default objects in a JSP for your convenience. Bill
I was happy to find this thread since this is exactly what I need to do -- access session information inside a custom tag. However, I had to change the code slightly from that mentioned above to get it to work. I was required to directly access the pageContext data member rather than being able to go through a getPageContext() acccessor method because no such method was available for me. So, my code looked like this: HttpSession session = pageContext.getSession(); I am posting this in case someone else is able to benefit from this thread as I have.