SpringBoot 页面加载Whitelabel Error Page

发布于 2022-09-11 14:37:38 字数 828 浏览 8 评论 0

问题描述

初次接触SpringBoot开发,使用控制器的转发视图的时候报的异常感觉是路径问题,但是不知道怎么改
页面显示 Whitelabel Error Page
No mapping found for HTTP request with URI [/student/classpath:/templates/student/index.html] in DispatcherServlet with name 'dispatcherServlet'

@Controller
@RequestMapping(value = "/student")
public class StudentController {

    @Autowired
    StudentService studentService;

    @RequestMapping(value = "/index")
    public String index(){
        return "student/index";
    }

#视图
spring.mvc.view.prefix=classpath:/templates/
spring.mvc.view.suffix=.html
spring.mvc.static-path-pattern=/static/**

springboot版本是2.0.6,求解答

图片描述

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丶情人眼里出诗心の 2022-09-18 14:37:39

你这是要用模板引擎么?建议看一下我springboot系列的文章,地址:https://somta.com.cn/blog/lis...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文