You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrew <as...@ezan.ac.ru> on 2001/06/06 10:36:13 UTC

JSP Session BUG

    Hi, when I use session.invalidate() and on the same page located <jsp:useBean id="xpeo" scope="session">, after invalidation, I've got the error:
getAttribute() IllegalStateException- session invalidated.That't true but it's OK and code in JSP must assume that xpeo=null, I mean:
//generated code
   com.ezan.PEO.XmlPEO xpeo = null;
                boolean _jspx_specialxpeo  = false;
                 synchronized (session) {
                    xpeo= (com.ezan.PEO.XmlPEO)
                    pageContext.getAttribute("xpeo",PageContext.SESSION_SCOPE);//this code must be in try/catch block for IllegalStateException xpeo=null
                    if ( xpeo == null ) {
                        _jspx_specialxpeo = true;
                        try {
                            xpeo = (com.ezan.PEO.XmlPEO) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.ezan.PEO.XmlPEO");
                        } catch (Exception exc) {
                             throw new ServletException (" Cannot create bean of class "+"com.ezan.PEO.XmlPEO", exc);
                        }
                        pageContext.setAttribute("xpeo", xpeo, PageContext.SESSION_SCOPE);
                    }
                 } 
Regards.