protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    RequestDispatcher dispatcher = null;
    try {
      // get the action class to be called
      // to do this, we grab the URL and take the ".action" off of it
      String servletpath = request.getServletPath().substring(1);
      int dot = servletpath.lastIndexOf(".action");
      if (dot <= 0) {
        throw new ServletException("Invalid action.  No method specified");
      }
      String className = servletpath.substring(0, dot);
      
      // get an instance of the action
      Class klass = Class.forName(className);
      Action action = (Action)klass.newInstance();

      // call the action 
      String viewPath = action.process(request, response);
      
      // get a dispatcher to the view (if the action returned something besides null)
      if (viewPath != null) {
        dispatcher = request.getRequestDispatcher(viewPath);
      }
      
    }catch (Exception e) {
      // this is wierd.  from a servlet, tomcat seems to inspect the embedded
      // exception, not the main exception.  so i'm embedding a WebException
      // inside a regular ServletException.  this makes tomcat (per web.xml)
      // call the /error.jsp page.
      if (e instanceof WebException) {  // already a WebException
        throw new ServletException(e);
      }else{  // wrap it in one
        throw new ServletException(new WebException("Error in controller: " + e.getMessage(), e));
      }//if
    }
    
    // forward to the JSP page
    if (dispatcher != null) {
      dispatcher.forward(request, response);
    }
    
  }