复选框未按应有的方式在 Thymeleaf 上显示

发布于 01-16 18:53 字数 612 浏览 2 评论 0原文

我的 Thymeleaf(使用 Bootstrap)模板上有一个复选框,因为它应该是这样。我有以下代码可将复选框添加到我的 html 模板中:

     <td>
        <input type="checkbox" name="products" th:value="${p.productId}">
    </td>

这是运行应用程序

时所拥有的内容在此处输入图像描述

当我单击复选框时,出现以下内容

在此处输入图像描述

我没有像平常那样在广场内进行正常的检查。我已重新启动计算机并清除缓存多次,但仍然遇到同样的问题。

可能是什么问题?

I have a checkbox on my Thymeleaf(using Bootstrap) templates as it should. I have the following code to add a checkbox to my html templates:

     <td>
        <input type="checkbox" name="products" th:value="${p.productId}">
    </td>

This is what I have when I run my application

enter image description here

When I click on a checkbox, I have the following

enter image description here

I do not have the normal check inside the square that we usually have. I have restarted my machine and cleared my cache several times, but I still have the same issue.

What could be the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

友欢2025-01-23 18:53:16

您可以这样使用:

<td>
<input type="checkbox" name="products" th:value="${p.productId}">[[${p.productId}]]
</td>

<td>
<input type="checkbox" name="products" th:value="${p.productId}">
<label>[[${p.productId}]]</label>
</td>

You can use like this:

<td>
<input type="checkbox" name="products" th:value="${p.productId}">[[${p.productId}]]
</td>

OR

<td>
<input type="checkbox" name="products" th:value="${p.productId}">
<label>[[${p.productId}]]</label>
</td>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文