<%@ page contentType="text/html;charset=utf-8" pageEncoding="utf-8"%> <html> <head> <title> show session </title> </head> <body> <center> <h2>获取session</h2> <% String sessionID= session.getId(); Long startTime=session.getCreationTime(); Long endTime=session.getLastAccessedTime(); Long time =(endTime-startTime)/ 1000; %> session ID: <%=sessionID%> </br> 停留时间: <%=time%> 秒 </center> </body> </html>