I have imageNames like wange/25011.jpg|wange/25011-1.jpg
or null, I want to split them to wange/25011.jpg
and wange/25011-1.jpg
, or no split if null. I tried code as below, but no work...
<td th:if="${brickset.imageNames} != null" th:each="image : ${#strings.arraySplit(brickset.imageNames, '|')}">
<a href="#" th:href="${imageBaseUrl + image}">
<img src="#" th:src="${imageBaseUrl + image}" height="64"/>
</a>
</td>
Here is my own answer:
<tbody id="portfolio" class="clear fix">
<tr th:each="brickset : ${bricksets}" th:alt="${brickset.description}">
<td>
<div th:unless="${brickset.imageNames == null}">
<div th:each="image,status : ${#strings.arraySplit(brickset.imageNames, '|')}">
<a href="#" th:href="${imageBaseUrl + image}" th:remove="${image} == null ? tag" th:title="${brickset.brand.name}">
<img src="#" th:src="${imageBaseUrl + image}" height="64" th:remove="${status.index} > 0 ? tag"/>
</a>
</div>
</div>
</td>
</tr>
</tbody>