Called in response to a GET request (data encoded in the URL)
ServletContext application = getServletContext();
ChatState chat = (ChatState)application.getAttribute(APP_STATE);
// assert(chat != null);
// to do: logic code and main HTML goes HERE.
String iSay = request.getParameter("iSay");
if (iSay != null) {
iSay = iSay.trim();
if (iSay.length() != 0) {
synchronized(chat) {
chat.chat.add(iSay);
chat.last++;
}
}
}
// Output section in MVC: dispatch to JSP to display the work.
// (Remember the URL for an RD **MUST** be absolute).
RequestDispatcher rd = application.getRequestDispatcher("/chat.jsp");
rd.forward(request, response);
/*NOTREACHED*/