更新时间:2023-11-22 18:40:52
即使这是一篇老文章,我也想分享我的解决方案.
Even though, it is an old post, I wanted to share my solution.
您实际上并不需要ModelAndView mv
方法参数.只需将其删除.
You don't actually need ModelAndView mv
method parameter. Just remove it.
以字符串形式返回视图名称:
Return view name as string:
@RequestMapping("/greeting")
public String greeting(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) {
model.addAttribute("name", name);
return "greeting";
}