Hello!
I found a mistake in implementation jsp standart.
Please, look at this code and comments in it.
------------------------------------------------------
package test;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

public class TestTag extends TagSupport implements
HttpSessionBindingListener, java.io.Serializable {

  public final int doEndTag() throws JspException {
    pageContext.getSession().setAttribute("stat.notify", this);
  }

  public void valueUnbound(HttpSessionBindingEvent event) {
   // MISTAKE!!!
   // When session expires or we execute session.invalidate(),
   // valueUnbound method is called and pageContext.getServletContext()
   // returns null!!! (in this example: context is null).
   ServletContext context = pageContext.getServletContext();
  }
}
--------------------------------------------------------------------
Regards, Yauheni Mikulski



Reply via email to