Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.20 KB | None | 0 0
  1. @Override
  2.     protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
  3.         Project formProject = (Project) command;
  4.         String previousPage = (String) request.getSession(true).getAttribute("previous_page");
  5.         if (previousPage != null) {
  6.             setSuccessView("redirect:" + previousPage);
  7.         } else {
  8.             setSuccessView("redirect:main.htm?action=release");
  9.         }
  10.         if (request.getParameter("save_action") != null) {
  11.             String action = request.getParameter("action");
  12.             System.out.println("action: " + action);
  13.             if ("new".equals(action)) {
  14.                 formProject.setCreateTime(new Date());
  15.                 formProject.setCreateUser("");
  16.                 formProject.setUpdateTime(new Date());
  17.                 formProject.setUpdateUser("");
  18.                 projectDao.save(formProject);
  19.             } else {
  20.                 projectDao.update(formProject);
  21.             }
  22.         } else if (request.getParameter("cancel_action") != null) {
  23.             //cancel
  24.         }
  25.         return super.onSubmit(request, response, command, errors);
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement