java中thymeleaf获取项目根路径
<a th:href="${#httpServletRequest.getContextPath()}"></a>
如Web项目名称为Demo,那么${#httpServletRequest.getContextPath()}获取到的值为Demo
<a th:href="${#httpServletRequest.getContextPath()}"></a>
如Web项目名称为Demo,那么${#httpServletRequest.getContextPath()}获取到的值为Demo