<!doctype html public "-//w3c/dtd HTML 4.0//en">
<html>
<!-- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.-->
<head>
<title>Simple Session</title>
</head>

<body bgcolor="#FFFFFF">
<font face="Helvetica">

<h2>
<font color=#DB1260>
Simple Session
</font>
</h2>

<p>
This servlet shows simple principles of session management
by incrementing a counter each time a user accesses a page.

<p>

<%!
  private int totalHits = 0;
%>

<%
  session = request.getSession(true);

  Integer ival = (Integer)session.getValue("simplesession.counter");
  if (ival == null) 
    ival = new Integer(1);
  else 
    ival = new Integer(ival.intValue() + 1);
  session.putValue("simplesession.counter", ival);
%>

<center>

<font size=+2>
You have hit this page <%= ival %> time<%= (ival.intValue() == 1) ? "" : "s" %>,
out of a total of <%= ++totalHits %> page hit<%= (totalHits == 1) ? "" : "s" %>!

</font>
</center>

<p>
<font size=-1>Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
</font>

</font>
</body>
</html>
