springBoot專案中的static和templates資料夾
阿新 • • 發佈:2018-11-17
記錄是為了更好的成長!
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"; }
以上內容代表個人觀點,僅供參考,不喜勿噴。。。