Hello everybody... I'm doing homework of servlet advanced chapter of Sang Shin's course and I try just to log the invocation to the methods "attributeAdded" and "attributeRemoved" both from HttpSessionAttributeListener class.
Inside the body of the servlet I add a new attribute to the request as this: *... if ((username != null) && (username.length() > 0)) { RequestDispatcher dispatcher = getServletContext() .getRequestDispatcher("/response"); String foo = "bar"; request.setAttribute("new_attr", foo); if (dispatcher != null) { dispatcher.include(request, response); } } ...* Simple, isn't it? and I remove this attribute in this part of the code: * ... PrintWriter out = response.getWriter(); request.removeAttribute("new_attr"); // then write the data of the response String username = request.getParameter("username"); ...* Of course I have implemented the methods: ... *public class OleServListener implements ServletContextListener, HttpSessionAttributeListener { ServletContext sc; public void contextInitialized(ServletContextEvent sce) { sc = sce.getServletContext(); sc.log("contextInitialized invoked."); }* ... * public void attributeAdded(HttpSessionBindingEvent se) { sc.log("Adding attr " + se.getName () + " with value " + se.getValue ()); } public void attributeRemoved(HttpSessionBindingEvent se) { sc.log("Removing attr " + se.getName () + " with value " + se.getValue ()); }* ... And here is the problem. I execute the servlet but in the glassfish log I don't get the messages from attributeAdded neither attributeRemove. I'm an absolute beginner with servlets so I suppose it's probably a simple error (I hope). I have check that the foo attribute it's being added printing it's value with System.out.println(request.getAttribute("new_attr").toString(), and as I expected, I get "bar" in glassfish's log. Have you any suggestions please? Thank you very much. -- David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en -~----------~----~----~----~------~----~------~--~---