java中thymeleaf获取项目根路径

<a th:href="${#httpServletRequest.getContextPath()}"></a>

如Web项目名称为Demo,那么${#httpServletRequest.getContextPath()}获取到的值为Demo

posted @ 2020-06-10 14:41  可达鸭给我冲鸭  阅读(1722)  评论(0编辑  收藏  举报