1 4 package com.tctest.performance.servlets; 5 6 import java.io.IOException ; 7 8 import javax.servlet.http.HttpServlet ; 9 import javax.servlet.http.HttpServletRequest ; 10 import javax.servlet.http.HttpServletResponse ; 11 import javax.servlet.http.HttpSession ; 12 13 public class SanityCheckServlet extends HttpServlet { 14 protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { 15 HttpSession session = req.getSession(); 16 res.getWriter().print(session.getId()); 17 18 String val = (String ) session.getAttribute("count"); 19 if (val == null) val = "0"; 20 21 res.getWriter().print("count=" + val); 22 23 int count = Integer.parseInt(val); 24 session.setAttribute("count", "" + ++count); 25 } 26 } 27 | Popular Tags |