我正在构建一个在Java HashMap
中具有值的项目,我想将其放入前端Thymeleaf中。尽管我在他们的文档和堆栈溢出上查找了一些代码,但似乎找不到一个很好的答案。我下面有一些无法传递值的代码,我想知道在哪里犯了错误。
因此,对于所有键,我试图将它们设置为optgroup
。对于值,我想使其为option
。任何帮助将不胜感激。
HTML:
<div class="row">
<div class="col col-lg-9 search-bar">
<div class="form-group">
<label>Type:</label>
<select class="js-example-basic-single2" id="selectData2">
<optgroup th:each="tierList : ${hmap}"
th:label="${tierList.key}">
<option th:each=" system : ${tierList.value}"
th:value="${system}"
th:selected="${system}"
th:text="${system}">
</option>
</optgroup>
</select>
</div>
</div>
</div>