Пример #1
0
  @Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {
    int projectid = Integer.valueOf(req.getParameter("projectid"));
    Project projectforEdit = project.getProjectById(projectid);
    String question = req.getParameter("question");
    if (question.length() > 0) {
      projectforEdit.asqAQuestion(req.getParameter("question"));
      project.save(projectforEdit);
    }

    Long donate = 0L;
    if (!req.getParameter("donate").equals("")) {
      donate = Long.valueOf(req.getParameter("donate"));
    }

    Long customDonate = 0L;
    if (!req.getParameter("customDonate").equals("")) {
      customDonate = Long.valueOf(req.getParameter("customDonate"));
    }

    if (donate > 0 || customDonate > 0) {
      if (customDonate > 0) {
        projectforEdit.updateBalance(customDonate);
        project.save(projectforEdit);
      } else {
        projectforEdit.updateBalance(donate);
        project.save(projectforEdit);
      }
    }
    this.showProjectDetails(req, resp);
  }
Пример #2
0
 private void showProjectDetails(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   int projectid = Integer.valueOf(req.getParameter("projectid"));
   req.setAttribute("project", project.getProjectById(projectid));
   req.setAttribute("paymetVariants", project.getProjectById(projectid).getPaymetVariants());
   req.setAttribute("categoryId", categoryId);
   req.getRequestDispatcher("projectdetails.jsp").forward(req, resp);
 }
Пример #3
0
 private void showProjectsFromCategory(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   categoryId = Integer.valueOf(req.getParameter("categoryId"));
   req.setAttribute("categoryName", category.getCategoryList().get(categoryId - 1));
   req.setAttribute("projectsFromCategory", project.getProjectFromCategory(categoryId).values());
   req.getRequestDispatcher("projects.jsp").forward(req, resp);
 }