Session Tracking Test 3

<%@ page import="java.util.Vector" session="true" errorPage="../error.jsp" %> <% // Get the person's session counter Integer ival = (Integer) session.getValue ("counter"); // The person is new, has no session counter if (ival == null) { ival = new Integer (1); } else ival = new Integer (ival.intValue() + 1); // Add the new Integer object to the session (with key = counter) session.putValue ("counter", ival); %> You are at stage <%= ival %> of the experiment.


Give a word:

<% // Let's just take POST requests if ( request.getMethod().equals("POST")) { // print contents of words Vector words = (Vector) session.getValue("words"); if (words == null) { words = new Vector (); } else { out.println("Last words were: "); for (int i=0; i 9) { %>

That is enough, but you can restart (needs to be implemented !!!!) <% } else { words.add(input); session.putValue ("words", words); } } %>

Click here to see the source