FYI: be careful how you setAttribute and getAttribute for session requests.
843838May 9 2007 — edited May 11 2007I've read a few resources online that state that using request.getSession().getAttribute("name") is the same as using request.getAttribute("name") and this is not generally true.
My development framework uses the Jetty 5.x embedded Jetty jsp context and web server. The jsp code is sensitive to where in the object hieararchy the "get" is used, so I recommend that any where you use:
request.setAttribute("name")
to get consistent results use
request.getAttribute("name")
to recover the attribute from the session.
Similarly , if you use :
request.getSession().setAttribute("name")
use
request.getSession().getAttribute("name")
to extract the object from the session. I spent a few hours over looking an inconsistency in how I was using the methods before I realized it was the source of an intermittent null pointer exception so keep your sets and gets consistent to avoid weird exceptions!
Regards,
David