Form is cleared after submit
Hi
I am new to spring mvc I am facing one issue once the form is submitted the older value in the form is still appearing:
Here is my post method for the form:
@RequestMapping(value = "/AddUser", method = RequestMethod.POST)
public ModelAndView saveUser(User user) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date currentDate = sdf.parse(sdf.format(new Date()));
user.setCreatDt(currentDate);
user.setUpdDt(currentDate);
user.setUpdBy("UBSPROD");
user.setCreatBy("UBSPROD");
userService.creatUser(user);
return new ModelAndView("/AddUser.jsp", "user", new User()).addObject(
"UserAdded", "userAdded");
}