Spring boot select类型的输入是否可以使用不扫描列表的选项来完成?

Spring boot select类型的输入是否可以使用不扫描列表的选项来完成?,spring-boot,spring-mvc,thymeleaf,Spring Boot,Spring Mvc,Thymeleaf,选项可以只是一个对象,而不是对象列表 在文档中,每一个都会扫描一个列表,但我想检索一个对象 <select th:field="*{type}"> <option th:each="type : ${allTypes}" th:value="${type}" th:text="#{${'seedstarter.type.' + type}}">Wireframe</option> </select>

选项可以只是一个对象,而不是对象列表

在文档中,每一个都会扫描一个列表,但我想检索一个对象

<select th:field="*{type}">
  <option th:each="type : ${allTypes}" 
          th:value="${type}" 
          th:text="#{${'seedstarter.type.' + type}}">Wireframe</option>
</select>

线框
有可能做像这样的事吗

  <option th:each="${Types}"

百里香的标准方言提供使用
th:each
。这是迭代的基础

“对于计算${allTypes}的结果中的每个元素,将该元素设置为名为type的变量,重复此模板片段。”

下拉选择器通常用于显示选项列表

您无法执行
th:each=“${Types}”
,因为您需要声明一个变量来访问迭代变量


在这种情况下,不需要使用
th:each
。只需放置线框