首页 > 编程语言 > 详细

springBoot项目中的static和templates文件夹

时间:2018-11-17 18:15:25      阅读:916      评论:0      收藏:0      [点我收藏+]

 

记录是为了更好的成长!

1、static文件中的页面

//这样写不能访问static中index文件夹下的index.html页面    
@RequestMapping("index")
    public String hello() {
        return "/index/index";
    }
//这样写才能访问到
@RequestMapping("index")
    public String hello() {
        return "/index/index.html";
    }

 

 2、templates文件夹中的页面

 

 

 

 

3、springBoot项目中Controller层的页面重定向问题

    @RequestMapping("index")
    public String hello() {
        return "/index/index.html";
    }
    
   //请求test会重定向到index     
    @RequestMapping("test")
    public String test() {
        return "redirect:/index";
    }      

 

 

 

 

 

 

 

 

 

 

以上内容代表个人观点,仅供参考,不喜勿喷。。。

springBoot项目中的static和templates文件夹

原文:https://www.cnblogs.com/newbest/p/9974959.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!