@RequestMapping(value = "/wfstepAdd", method = RequestMethod.GET) @RequestScoped public String saveWFStepDetails( @ModelAttribute("wfstepAdd") @Valid WFStep wfstep, BindingResult result, DefaultSessionAttributeStore store, WebRequest request1, HttpServletRequest request, SessionStatus status, Model model, HttpServletResponse response) { sess = request.getSession(false); Calendar currentDate = Calendar.getInstance(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String createdDate = formatter.format(currentDate.getTime()); wfstep.setWfstepCreatedBy(sess.getAttribute("userId").toString()); wfstep.setWfstepCreatedDate(createdDate); String msg = null; String res = null; String wfStepSave = null; Long duplicateId = 0l; try { // here we set the CharacterEncoding to resonse becoz of // Localization Concept // this method is used to check the Duplicates String sid = wfstep.getWfstepStageGUID(); System.out.println("stagename" + sid); String stepName = wfstep.getWfstepName(); duplicateId = wfstepService.duplicateWFStepCheck(sid, stepName); if (duplicateId == 0) { // here there are no duplicates // saveRoleDetails this method is used to save Role Details msg = wfstepService.saveWFStepDetails( wfstep, sess.getAttribute("userId").toString(), sess.getAttribute("userName").toString()); model.addAttribute("wfstepAdd", new WFStep()); if (msg.equals("S")) { res = "redirect:wfstepHome.mnt?list=" + "success" + ""; } else { res = "redirect:wfstepHome.mnt?listwar=" + "fail" + ""; } } else { request.setAttribute("WFStepDuplicate", "WFStep Name"); wfstep.setAid(1); return "wfstepHome"; } } catch (Exception e) { res = "redirect:wfstepHome.mnt?listwar=" + "fail" + ""; e.printStackTrace(); } return res; }