public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {

    String email = req.getParameter("email");
    String passwd = req.getParameter("password");
    String landingPage = AppConstants.HOMEPAGE;

    try {
      AppUser user = UserBO.loginUser(email, passwd);
      req.getSession().setAttribute(AppConstants.USER_IN_SESSION, user);
      List<Project> projects = null;
      try {
        projects = ProjectBO.getProjectList(user.getId());
        req.setAttribute("projects", projects);
      } catch (Exception e) {
        log.log(Level.WARNING, e.getMessage());
      }
    } catch (UserNotFoundException e) {
      log.info(email + " is not registered");
      landingPage = AppConstants.REGISTRATION_PAGE;
    } catch (IncorrectLoginException e) {
      log.info(email + " is not registered");
      req.getSession().setAttribute(AppConstants.USER_LOGIN_STATUS, AppConstants.LOGIN_INVALID);
      landingPage = AppConstants.LOGIN_PAGE;
    }
    forwardToPage(landingPage, req, resp);
  }
  public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {

    String action = req.getParameter("action");
    String projectName = req.getParameter("projname");
    String projectDesc = req.getParameter("projdesc");
    Date startDate = getFormattedDate(req.getParameter("startDate"));
    Date endDate = getFormattedDate(req.getParameter("endDate"));
    String landingPage = AppConstants.HOMEPAGE;

    if (AppConstants.ACTION_CREATE_PROJECT.equalsIgnoreCase(action)) {
      AppUser user = (AppUser) req.getSession().getAttribute(AppConstants.USER_IN_SESSION);
      if (user != null) {
        try {
          ProjectBO.createProject(projectName, projectDesc, user.getId(), startDate, endDate);
          List<Project> projects = ProjectBO.getProjectList(user.getId());
          req.setAttribute("projects", projects);
        } catch (Exception e) {
          log.log(Level.WARNING, e.getMessage());
        }
      }
    } else if (AppConstants.ACTION_DETAIL_PROJECT.equalsIgnoreCase(action)) {
      AppUser user = (AppUser) req.getSession().getAttribute(AppConstants.USER_IN_SESSION);
      if (user != null) {
        try {
          Long projectId = Long.parseLong(req.getParameter("projId"));
          List<Task> tasks = TaskBO.getTaskList(user.getId(), projectId);
          req.setAttribute("tasks", tasks);
          Project proj = ProjectBO.getProject(projectId);
          if (proj != null) {
            req.setAttribute("tasks", tasks);
            req.setAttribute("project", proj);
            landingPage = AppConstants.PROJECT_DETAIL_PAGE;
          } else {
            landingPage = AppConstants.GENERIC_ERROR_PAGE;
          }

        } catch (Exception e) {
          log.log(Level.WARNING, e.getMessage());
        }
      }
    }
    forwardToPage(landingPage, req, resp);
  }