thymeleaf 页面获取当前页面的完整URL地址

下面两种方法是一样的

<div th:text="${#httpServletRequest.getRequestURL() +'?'+ #httpServletRequest.getQueryString() }"></div>
<div th:text="${#httpServletRequest.requestURL +'?'+ #httpServletRequest.queryString }"></div>

#httpServletRequest 标签还有很多相关的方法, 自己试试吧

原创文章,欢迎转载,转载请注明出处!

原文地址:https://www.cnblogs.com/acm-bingzi/p/thymeleaf_url.html