<HTML>
<HEAD>
	<TITLE>JSP session page</TITLE>
	<%@ page import="javax.servlet.*" %>
	<%@ page import="javax.servlet.http.*" %>
</HEAD>
<BODY>

<H1>JSP session page</H1>

<SCRIPT runat=server>
	private int totalHits = 0;

	/* make sure the session is created before anything else happens */
	public void service(HttpServletRequest req, HttpServletResponse res)
		throws ServletException, java.io.IOException
	{
		req.getSession(true);
		doIt(req, res);
	}
</SCRIPT>

<%
	HttpSession ses = request.getSession(true);
	Integer ival = (Integer) ses.getValue("session.jsp.counter");
	if(ival == null) {
		ival = new Integer(1);
	} else {
		ival = new Integer(ival.intValue() + 1);
	}
	ses.putValue("session.jsp.counter", ival);
%>

This page has been hit xx times, of which <%= ival %> hits were yours.

</BODY>
</HTML>
