addObject
public ModelAndView addObject(String modelName, Object modelObject)
- Add an object to the model.
- Parameters:
modelName
- name of the object to add to the modelmodelObject
- object to add to the model. May not benull
.- Returns:
- this ModelAndView, convenient to allow usages like return modelAndView.addObject("foo", bar);
@RequestMapping(value = "/updateForm.do", method = RequestMethod.GET)
public ModelAndView updateForm(@RequestParam(value="seq",required = true)String seq ){
ModelAndView mav = new ModelAndView();
BoardDto board = boardService.select(seq);
mav.addObject("board_data",board);
mav.setViewName("update");
return mav;
} // end updateForm
public ModelAndView updateForm(@RequestParam(value="seq",required = true)String seq ){
ModelAndView mav = new ModelAndView();
BoardDto board = boardService.select(seq);
mav.addObject("board_data",board);
mav.setViewName("update");
return mav;
} // end updateForm
setViewName
public void setViewName(String viewName)
- Set a view name for this ModelAndView, to be resolved by the DispatcherServlet via a ViewResolver. Will override any pre-existing view name or View.