【问题标题】:dropdown menu not showing in Spring / Java下拉菜单未在 Spring/Java 中显示
【发布时间】:2019-02-24 04:33:56
【问题描述】:

有人知道为什么我的下拉选项没有呈现在我的表单中吗?我有这个 html 表单渲染,但选项没有出现。我还有一个模型中的表单输入字段,列为私有字符串业务类;然后也是它的getter和setter。我错过了什么吗?

<div class="row">
            <label for="businessClass" >Business Class: </label>
            <select class="select-2 form-control" field="*{businessClass}" id="businessClass" >
                    <option value="Animal Services">Animal Services</option>
                    <option value="Arts Entertainment">Arts &amp; Entertainment</option>
                    <option value="Auto Services">Auto Services</option>
                    <option value="bonds">Bonds</option>
                    
             </select>

【问题讨论】:

    标签: java spring thymeleaf render dropdown


    【解决方案1】:

    我可以看到一个问题。如果您使用的是 thymeleaf,则必须将属性与

    绑定
    th:field="*{...}"
    

    不仅如此

    field="*{}".
    

    也许还有更多问题,但这就是给定 sn-p 中的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-26
      • 1970-01-01
      • 2019-07-17
      • 1970-01-01
      • 2017-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多