<%@ page import="java.util.*" %>
<%
// add parameter to session
String name = request.getParameter("name");
String value = request.getParameter("value");
if (name!=null && value!=null && name.length()>0) {
session.setAttribute(name,value);
}
Date lastVisit = (Date)session.getAttribute("lastVisit");
Date thisVisit = new Date();
%>
Session List
Session List
Last visit: <%= lastVisit %>
This visit: <%= thisVisit %>
Session ID: <%= session.getId() %>
Session max interval: <%= session.getMaxInactiveInterval() %>
Session parameters
<%
Enumeration enum = session.getAttributeNames();
while (enum.hasMoreElements()) {
String attribute = (String) enum.nextElement();
out.println(""+attribute+"="+
session.getAttribute(attribute)+"
");
}
session.setAttribute("lastVisit",thisVisit);
%>
New session parameter
JSP-New-Session-Parameter.zip( 89 k)