Ejemplo n.º 1
0
  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    String id = req.getParameter("id");
    String password = req.getParameter("password");

    if (id == null || id.length() == 0 || password == null || password.length() == 0) {
      resp.sendError(400, "incomplete parameter");
      return;
    }

    AccountService service = (AccountService) context.getBean("accountService");

    try {
      service.login(id, password);
      resp.getWriter().print("Login Successful!");
    } catch (AccountServiceException e) {
      resp.sendError(400, e.getMessage());
    }
  }