String waitStr = request.getParameter("time");
if ( waitStr == null )
throw new ServletException("Missing parameter: time");
int wait = Integer.parseInt(waitStr);
try {
Thread.sleep( wait * 1000 );
} catch( InterruptedException e ) {
throw new ServletException(e);
}
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><body><h1>WaitServlet Response</h1></body></html>");