Which is better, return “ModelAndView” or “String” on spring3 controller

前端 未结 2 910
梦如初夏
梦如初夏 2020-11-28 18:32

The way of return ModelAndView

@RequestMapping(value = \"/list\", method = RequestMethod.GET)
public ModelAndView list(
    @UserAuth UserAuth user, 
    Mod         


        
2条回答
  •  清酒与你
    2020-11-28 19:03

    I would like to add me 2 cents also. Second approach is more towards convention oriented i.e developer does explicitly mention what is his view but its implicit that return string is view name. So less coding,readable and standard. Much better than older way with ModelAndView

提交回复
热议问题