% if (request.getParameter ("action") == null) { %>
Welcome to the Internet Psychologist!
The psychologist can see you now...please enter your name and click the Introduce button.
<% } else if (request.getParameter ("action").equals ("goto_question")) { %>Hello, <%= name %>
<% if (request.getParameter ("statement") == null) { %>Enter a statement in the edit field below about how you are feeling.
<% } else { %><%= processStatement (request.getParameter ("statement"))%>
If you would like to continue talking with the psychologist enter another statement
<% Integer num = (Integer) session.getAttribute ("num_statements"); if (num != null) session.setAttribute("num_statements", new Integer (num.intValue() + 1)); else session.setAttribute("num_statements", new Integer (1)); } %> <% } else if (request.getParameter ("action").equals ("goto_statistics")) { %>Your Psychologist Statistics:
<% String name = request.getParameter ("name"); Integer number = (Integer) session.getAttribute ("num_statements"); int num = 0; if (number != null) num = number.intValue (); %>You have made <%= num %> statements to the psychologist.
<% } else { /* An incorrect action! */ %>Sorry, the Psychologist is having a bad day.
The action was: <%= request.getParameter ("action") %>
<% } %> <%! /* Private methods */ private String processStatement (String statement) { return "How do you feel when you say, \"" + statement + "\""; } %>