have a look at the below code snippet.
@RequestMapping(value = "edit.htm", method = RequestMethod.GET)
public ModelAndView edit(@RequestParam("id") String id) throws Exception {
ModelMap modelMap = new ModelMap();
modelMap.addAttribute("user", userinfoDao.findById(id));
return new ModelAndView("edit", modelMap);
}
If you want the complete project to see how it works then download it from below link:-