HttpSessionListener.sessionCreated() not being called

后端 未结 3 834
遥遥无期
遥遥无期 2021-01-16 07:32

I have a very simple Servlet and a very simple HttpSessionListener:

@WebServlet(\"/HelloWorld\")
public class HelloWorld extends HttpServlet {
    private st         


        
3条回答
  •  醉梦人生
    2021-01-16 08:30

    If you're not using @WebListener make sure your listeners are referenced in the web.xml.

    ...
        
            com.yoursite.YourSessionListener
        
    

    In order to receive these notification events, the implementation class must be either declared in the deployment descriptor of the web application, annotated with WebListener, or registered via one of the addListener methods defined on ServletContext.

提交回复
热议问题