以前我们都是后端返回页面

比如

@RequestMapping("/login")
public String login(){
return "index/index_login";
}



这个就返回到了登录页面

 我现在想在springboot里面做一个前台访问的页面

  • 需要将前台静态资源文件写在static下面
  • mvc:
    static-path-pattern: /static/**     这个是一定要有的配置的哦,否则访问不到的呢
  • springboot静态文件访问_html

 

然后我进行测试,在static下面放了个​​index​​​文件夹,文件夹里面有个page.html,然后通过​​http://localhost:8080/static/index/page1.html​​就访问到啦

springboot静态文件访问_html_02