コード例 #1
0
 @RequestMapping(path = "addEmployee.do", method = RequestMethod.GET)
 public ModelAndView addEmployeeForm() {
   stateDAO.initStates();
   ModelAndView mv = new ModelAndView();
   mv.setViewName("add.jsp");
   mv.addObject("states", stateDAO.getAbbrev());
   mv.addObject(new Employee());
   return mv;
 }
コード例 #2
0
  @RequestMapping(path = "updateEmployee.do", params = "id", method = RequestMethod.GET)
  public ModelAndView editEmployee(@RequestParam("id") int id) {
    Employee emp = dao.getEmployee(id);

    ModelAndView mv = new ModelAndView();
    mv.setViewName("updateEmployee.jsp");
    mv.addObject("employee", emp);
    mv.addObject("states", stateDAO.getAbbrev());
    return mv;
  }