在瀏覽器用鏈接http://localhost:8080/city/page/list 訪問時頁面上只出現了cityList字樣,預期是返回cityList.html
解決:在controller中使用了注解@RestController,修改注解為@Controller.
原因:RestController = Controller + ResponseBody.加上RestController,返回的內容是你return中的內容,如果是return "Hello World",頁面顯示的就是Hello World。加上Controller,返回的是return中對應的頁面,比如return “hello”,頁面的名稱是hello。