久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

Springboot訪問html頁面步驟解析

瀏覽:134日期:2023-05-11 13:29:10

springboot中如果想訪問html頁面,不每訪問一個頁面就寫一個Controller,可以統一寫一個公共的controller方法

代碼:

(1)引入hutool工具依賴

<!-- hutool工具包--><dependency> <groupId>com.xiaoleilu</groupId> <artifactId>hutool-all</artifactId> <version>3.3.0</version></dependency>

(2)公共Controller

import com.xiaoleilu.hutool.util.StrUtil;//html訪問控制器/** * @return */@RequestMapping(value = '/view/**', method = RequestMethod.GET)public String html(HttpServletRequest request) { return StrUtil.removePrefix(request.getRequestURI(), request.getContextPath() + '/view');}

(3)訪問頁面路徑

如頁面路徑在demo下,配置文件中servlet.context-path: /test

Springboot訪問html頁面步驟解析

則lhttp://localhost:8081/test/view/demo/...../XXX.html

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Spring
相關文章:
主站蜘蛛池模板: 博罗县| 卢氏县| 淮南市| 阳高县| 乌苏市| 巩留县| 卢龙县| 浑源县| 莱阳市| 兴和县| 新巴尔虎右旗| 甘德县| 竹山县| 泰兴市| 巴林左旗| 合作市| 鄢陵县| 中西区| 吉首市| 奎屯市| 花垣县| 郴州市| 景泰县| 休宁县| 康定县| 绿春县| 馆陶县| 韩城市| 孟村| 刚察县| 永安市| 福建省| 临邑县| 诸城市| 滁州市| 盐池县| 抚顺市| 临湘市| 芦溪县| 葵青区| 桐城市|