1、转发
方式一:使用 "forword" 关键字(不是指java关键字),注意:类的注解不能使用@RestController 要用@Controller
@RequestMapping(value="/test/test01/{name}" , method = RequestMethod.GET)
public String test(@PathVariable String name) {
return "forword:/ceng/hello.html";
}
方式二:使用servlet 提供的API,注意:类的注解可以使用@RestController,也可以使用@Controller
@RequestMa

本文详细介绍了在SpringBoot中如何实现请求的转发和重定向,包括使用`forward`和`redirect`关键字以及Servlet API的方法。无论选择哪种方式,都需要根据实际情况选择合适的Controller注解。
最低0.47元/天 解锁文章
3236

被折叠的 条评论
为什么被折叠?



