【发布时间】:2022-01-24 13:58:41
【问题描述】:
我在将来自 message.properties 文件的值发送到 thymeleaf 片段页面时遇到问题。 在我将 message.properites 文件中的值定义为 "brand.name" 后,我想将其发送到该页面,但我无法处理。
即使我可以使用column_link('name',[[#{brand.name}]],'none')" 或column_link('name',#{brand.name},'none')",我也无法在片段中显示名称。
我该怎么做?
这是我的 message_en.properties 文件,如下所示。
...
brand.name = Brand Name:
...
这是我的 HTML 页面,如下所示。
...
<th th:replace="fragments :: column_link('name','Brand Name','none')" />
...
这是我的片段页面,如下所示。
<th th:fragment="column_link(fieldName, columnLabel, removeTag)" th:remove="${removeTag}">
<a class="text-white"
th:href="@{${moduleURL} + '/page/' + ${currentPage} + '?sortField=' + ${fieldName} +'&sortDir=' + ${sortField != fieldName ? sortDir : reverseSortDir} + ${keyword != null ? '&keyword=' + keyword : ''}">
[[${columnLabel}]]
</a>
<span th:if="${sortField == fieldName}"
th:class="${sortDir == 'asc' ? 'fas fa-sort-up' : 'fas fa-sort-down'}" ></span>
</th>
【问题讨论】:
标签: java spring-boot properties thymeleaf