<%@ page session="true" %>
<%
// Get the session data value
Integer ival = (Integer) session.getValue ("sessiontest.counter");
if (ival == null) ival = new Integer (1);
else ival = new Integer (ival.intValue() + 1);
session.putValue ("sessiontest.counter", ival);
%>
You have hit this page <%= ival %> times.
<%
out.println("Your Session ID is " + session.getId() + "
");
%>
Click here to see the source