Reputation: 35
<c:forEach var="item" items="${list}" >
<option value="${item}"> something </option>
</c:forEach>
How can i do this in thymeleaf?
I've tried something like this:
<option th:each="item:${list}" value="${item}"> some product $ </option>
but it uses ${item} like a simple text "${item}".
Upvotes: 0
Views: 1243
Reputation: 405
Have you tried this:
<option th:each="item:${list}" th:value="${item}"> some product $ </option>
You may just be missing the th: prefix for the value attribute.
Upvotes: 1