springBoot项目中的static和templates文件夹

时间:2018-11-17 19:28:01   收藏:0   阅读:1359

 

记录是为了更好的成长!

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";
    }      

 

 

 

 

 

 

 

 

 

 

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

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!