问答详情
源自:3-4 属性的增加和删除的事件监听器

为啥每次点init或destroy按钮都会重新创建session,运行结果如下:

1.进入index.jsp

requestInitialized : name = null

ServletRequest_attributeReplaced: org.apache.catalina.ASYNC_SUPPORTED

sessionCreated

requestDestroyed

2.第一次点击init按钮

requestInitialized : name = null

ServletRequest_attributeReplaced: org.apache.catalina.ASYNC_SUPPORTED

sessionCreated

ServletRequest_attributeAdded: requestName

HttpSession_attributeAdded: sessionName

ServletContext_attributeReplaced: applicationName

requestDestroyed

3.第二次点击init按钮

requestInitialized : name = null

ServletRequest_attributeReplaced: org.apache.catalina.ASYNC_SUPPORTED

sessionCreated

ServletRequest_attributeAdded: requestName

HttpSession_attributeAdded: sessionName

ServletContext_attributeReplaced: applicationName

requestDestroyed

4.点击destroy按钮

requestInitialized : name = null

ServletRequest_attributeReplaced: org.apache.catalina.ASYNC_SUPPORTED

sessionCreated

HttpSession_attributeAdded: sessionName

ServletContext_attributeReplaced: applicationName

requestDestroyed


提问者:慕哥7786388 2016-07-12 14:56

个回答

  • 何惊
    2017-10-27 17:38:02

    session timeout设置为0

  • 摩诃迦叶
    2016-08-17 23:19:14

    问题应该出现在你的web.xml中,把web.xml贴出来吧,应该是你给servlet添加了一个ASYNC属性

  • 慕粉18138870095
    2016-07-13 14:18:48

    什么东东