繁体   English   中英

<a>在 thymeleaf 迭代中使用标签</a>

[英]Using <a> tag in thymeleaf iteration

我需要使用 thymeleaf 显示来自列表的链接列表。 我使用以下代码成功地做到了这一点:

<div class="col-12 col-md-6" th:each="ApplicationVO: ${ApplicationList}"> 
              <a class="service-link shadow" title="MMIS" href="mmis.html" target="_blank"><span th:text="${ApplicationVO.applicationName} +'&raquo'"></span></a>
          </div>

我的问题是如何将链接(href)和标题作为 ApplicationVO.applicationLink 和 ApplicationVO.displayName 放在锚标记中?

我猜你需要使用 th:href 标签:

<div class="col-12 col-md-6" th:each="ApplicationVO: ${ApplicationList}"> 
          <a class="service-link shadow" title="MMIS" th:href="@{${ApplicationVO.applicationLink}}" target="_blank"><span th:text="${ApplicationVO.applicationName} +'&raquo'"></span></a>
</div>

我认为您也可以像这样删除 span 标签:

<div class="col-12 col-md-6" th:each="ApplicationVO: ${ApplicationList}"> 
          <a class="service-link shadow" title="MMIS" th:text="${ApplicationVO.applicationName} +'&raquo'" th:href="@{${ApplicationVO.applicationLink}}" target="_blank"></a>
</div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM