我在HTML中有一个过滤器表单,它通过GET请求发送过滤指令。过滤之后,我的<select>
不会从传递的请求参数中加载值,但<input>
会使用它们的th:value
。如何指示<select>
从URL参数中获取所选值(通过get传递)?我知道我可以使用th:field
从模型中的对象获取值,但这不是我想要做的,我希望这个控件选择的数据是在请求中传递的。
这在<input>
上运行得很好
<input th:value="${param.minFee}" placeholder="Min. Fee" class="form-control" type="number" min="0" max="100" step="0.01" id="minFee" name="minFee"/>
如何使此<select>
从请求参数中获取其选定值?
<select class="form-control" name="payingCurrency" id="payingCurrency">
<option th:value="-1">Any</option>
<option th:each="currency : ${currencies}"
th:value="${currency}"
th:text="${currency.name}"></option>
</select>
https://stackoverflow.com/questions/50969134
复制相似问题