Returns the counter held in the session scope, or a new
counter if it doesn't exist.
HttpSession session = hse.getSession();
ServletContext context = session.getServletContext();
int[] counter = (int[]) context.getAttribute(COUNTER_ATTR);
if (counter == null) {
counter = new int[1];
context.setAttribute(COUNTER_ATTR, counter);
}
return counter;