Example #1
0
 @Override
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   String length = request.getParameter("primeLength");
   ServletContext context = getServletContext();
   synchronized (this) {
     if ((context.getAttribute("primeBean") == null) || (!isMissing(length))) {
       PrimeBean primeBean = new PrimeBean(length);
       context.setAttribute("primeBean", primeBean);
     }
     String address = "/WEB-INF/results/show-prime.jsp";
     RequestDispatcher dispatcher = request.getRequestDispatcher(address);
     dispatcher.forward(request, response);
   }
 }
 protected void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   request.getRequestDispatcher("/home.jsp").include(request, response);
 }