@RequestMapping(value = "/wfstepUpdate", method = RequestMethod.POST) @RequestScoped public String updateWFStep( @ModelAttribute("wfstepAdd") WFStep wfstep, HttpServletRequest request, Model model, HttpServletResponse response) { response.setCharacterEncoding("UTF-8"); Long duplicateId = 0l; try { duplicateId = wfstepService.updateDuplicateCheck( wfstep.getWfstepNameEdit(), wfstep.getWfstepidEdit(), wfstep.getWfstepStageGUIDEdit()); if (duplicateId == 0) { wfstep.setWfstepid(wfstep.getWfstepidEdit()); wfstep.setWfstepStageGUID(wfstep.getWfstepStageGUIDEdit()); wfstep.setWfstepStatus(wfstep.getWfstepStatusEdit()); wfstep.setWfstepStep(wfstep.getWfstepStepEdit()); wfstep.setWfstepAssignedTo(wfstep.getWfstepAssignedToEdit()); wfstep.setWfstepName(wfstep.getWfstepNameEdit()); wfstep.setWfstepType(wfstep.getWfstepTypeEdit()); wfstep.setWfstepCreatedBy(wfstep.getWfstepCreatedByEdit()); wfstep.setWfstepCreatedDate(wfstep.getWfstepCreatedDateEdit()); HttpSession sess = request.getSession(); Calendar currentDate = Calendar.getInstance(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String updatedDate = formatter.format(currentDate.getTime()); wfstep.setWfstepUpdatedBy(sess.getAttribute("userId").toString()); wfstep.setWfstepUpdatedDate(updatedDate); String msg = wfstepService.updateWFStep(wfstep); if (msg.equals("S")) { request.setAttribute( "wfstepUpadteSuccess", "Work Flow Step has been updated Successfully"); } else { request.setAttribute("wfstepUpadteFail", "Work Flow Step has not been updated"); } } else { request.setAttribute("wfstepEditDuplicate", "Name Already Exists"); request.setAttribute("wfstepValues", "wfstepValues"); return "wfstepHome"; } } catch (Exception e) { e.printStackTrace(); } model.addAttribute("wfstepAdd", new WFStep()); /* return new ModelAndView("Home","materialAdd",new Material()); */ return "wfstepHome"; }