Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 百里香叶-附加<;br>;输入标签_Html_Thymeleaf - Fatal编程技术网

Html 百里香叶-附加<;br>;输入标签

Html 百里香叶-附加<;br>;输入标签,html,thymeleaf,Html,Thymeleaf,我试图在表单中的每个输入行之后追加一个,但Thymeleaf一直给我解析错误 以下是我遇到问题的代码片段: <form th:if="${not #lists.isEmpty(brands)}"> <input th:each="brand : ${brands}" type="checkbox" th:value="${brand.name}" th:utext="${brand.name + <br>}" /> </form> 如果我将标

我试图在表单中的每个输入行之后追加一个

,但Thymeleaf一直给我解析错误

以下是我遇到问题的代码片段:

<form th:if="${not #lists.isEmpty(brands)}">
<input th:each="brand : ${brands}" type="checkbox" th:value="${brand.name}" th:utext="${brand.name + <br>}" />
</form>

如果我将

标记添加到输入标记之外,它不会将其添加到每一行


提前谢谢

我想你可能做得不对

将在
节点中插入该值。但是,根据,在
标记(“内容模型:空”)中没有任何内容

我想你想要更像这样的东西:

<form th:if="${not #lists.isEmpty(brands)}">
    <th:block th:each="brand : ${brands}">
        <label th:for="${#ids.next('brand')}" th:text="${brand.name}">Brand A</label>
        <input type="checkbox" th:id="${#ids.seq('brand')}"
            name="brand" th:value="${brand.name}"/>
        <br/>
    </th:block>
</form>

品牌A


如果您使用的是SpringMVC,您可能还会发现这个示例很有帮助:

不应该用引号括起来吗?我不知道thymeleaf,但我觉得很奇怪,
不是介于“”之间,你是说
th:utext=“${brand.name}”+”
?如果是,这是Thymeleaf中的语法错误。我的意思是th:utext=“${brand.name+'
'}”也不起作用。相同的解析错误。这段代码在${#ids.next('brand')}处给了我一个错误,但除此之外,它修复了br问题。谢谢你链接到这个例子。哎呀,我想我错过了一个
}
。。。尝试编辑的版本。