session.removeAttribute at END of JSP is causing use of the session object in the MIDDLE to fail
Posted on 2004-04-07
I am setting a session object called errors within a Struts backend Action. A servlet for those who don't use Struts. My action then forwards to a JSP. This JSP is included by a master layout JSP, and in the middle if it detects the errors object in the session it iterates over it. At the end of the page I need to make sure that the errors object is gone but not other session objects, so I use the session.removeAttribute method.
I have determined that placing this removeAttribute call anywhere in the JSP including not only at the end, but also in the master template JSP that includes this current JSP causes the errors object to nullify and it cannot be iterated over!!
My question is how on earth can I use the object and then get rid of it before the next request? I do not want to get rid of it ON the next request but at the END of processing the error showing JSP.
And by the way I cannot use the request scope ... I need the session in this particular case because of an IIS bug I am working around.