SpringBoot使用 thymeleaf+@RestController 跳转页面

thymeleaf推荐使用@Controller进行页面跳转
如果用@RestController,则可以通过ModelAndView进行页面跳转
eg

/**
 * 跳转到goods_editor.html页面
 * @return
 */
@GetMapping("/goodsEditor")
public ModelAndView goodsEditor(){
	ModelAndView mv = new ModelAndView();
	mv.setViewName("/goods/goods_editor");
	return mv;
}

猜你喜欢

转载自blog.csdn.net/tian_ci/article/details/88656123