Hi again, can anyone explain why the code below doesn't execute the
attributeAdded(...) method
package pack1;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ShowFrame extends HttpServlet implements ServletContextAttributeListener
{
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
this.getServletContext().setAttribute("name","cat");
String v=(String)this.getServletContext().getAttribute("name");
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
// TODO output your page here
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet ShowFrame</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>V = "+v+"</h1>");
out.println("</body>");
out.println("</html>");
out.close();
}
public void attributeAdded(ServletContextAttributeEvent scab)
{
this.getServletContext().setAttribute("name","chicken");
}
public void attributeRemoved(ServletContextAttributeEvent scab)
{
this.getServletContext().setAttribute("name","chicken");
}
public void attributeReplaced(ServletContextAttributeEvent scab)
{
this.getServletContext().setAttribute("name","chicken");
}
}
The servlet is included in the web.xml file under <listener> tag, and I'm using Netbeans 5.0.
Thanks for any help