<li <c:if test="${!page.hasPreviouse}">class="disabled"</c:if>> <a href="?start=${page.start-page.count}" aria-label="Previous" > <span aria-hidden="true">‹</span> </a> </li> 使用thymeleaf怎么写
时间: 2023-10-16 09:10:37 浏览: 40
使用 Thymeleaf 写这段代码应该是这样的:
```html
<li th:classappend="${!page.hasPrevious} ? 'disabled'">
<a th:href="@{${'/?start=' + (page.start - page.count)}}"
aria-label="Previous">
<span aria-hidden="true">‹</span>
</a>
</li>
```
其中,`th:classappend` 属性用于根据条件添加样式类,`th:href` 属性用于生成动态链接。需要注意的是,在 Thymeleaf 中使用表达式语言时,需要使用 `${}` 或 `*{}` 包裹表达式。