跳转方式
- 默认跳转方式请求转发
@RequestMapping("demo")
public String demo(){
return "main.jsp";
}
- 设置返回值字符串内容
2.1 添加 redirect:资源路径 重定向
@RequestMapping("demo")
public String demo(){
System.out.println("重定向");
return "redirect:main.jsp";
}
2.2 添加 forward:资源路径 或省略 forward: 转发
@RequestMapping("demo")
public String demo(){
System.out.println("转发");
return "main.jsp";
}