<p th:text=${salecode}></p> <a th:href="${#httpServletRequest.getScheme()+'://'+#httpServletRequest.getServerName()+':'+#httpServletRequest.getServerPort()+#httpServletRequest.getContextPath()+'/icon/'+salecode } " ></a>
效果圖如下:
插入一段本地不需要加上項目名稱,在正式環境下服務器下需要加上項目名稱的判斷,免得本地和服務器上都改來改去,有時候忘記改了,就gg了:
<a class="item" th:each="taopiao,u : ${list}" th:if="${#httpServletRequest.getServerPort()} ne 8080" th:href="'/fastbuytickets/purchase?id='+${taopiao.productId}"> 服務器調測 </a> <a class="item" th:each="taopiao,u : ${list}" th:if="${#httpServletRequest.getServerPort()} eq 8080" th:href="'/purchasetest?id='+${taopiao.productId}"> 本地調測 </a>
自己當筆記用,不給壞人用