thymeleaf 标签:
${#httpServletRequest.getContextPath()}
直接引用 th:οnclick="@{'location.href=\'' + ${#httpServletRequest.getContextPath()} + '/xxxx\'}"
其它:${#servletContext.contextPath}
javascript中引用
<!-- 根路径 -->
<script type="text/javascript" th:inline="javascript">
/*<![CDATA[*/
ctxPath = /*[[@{/}]]*/ '';
/*]]>*/
console.info(ctxPath);
</script>