java - Thymeleaf 下拉列表 + 引导程序
问题描述
在我的应用程序中,我有一个使用枚举值的 thymeleaf 下拉列表。
我想将它与引导程序连接以使其具有更好的方面,我试图自己做,并试图在互联网上找到一些帮助,但仍然没有。
我的下拉列表:
<div class="dropdown">
<form th:object="${money}" th:action="@{saveOperation}" action="#" method="post">
<select th:field="*{name}">
<option th:each=" value : ${T(com.bartosz.kolej.whereismymoney.operations.model.MoneyOperations.OperationsNames).value()}"
th:value="${value}"
th:text="${value.getDisplayName()}">
</option>
</select>
<input type="number" required th:field="*{value}" class="form-controll" placeholder="value" step="0.01 "/>
<input type="submit" class="btn btn-warning" th:value="Save"/>
</form>
我想将它插入这样的代码中:
<div class="dropdown show">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Dropdown link
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
解决方案
像这样的东西:
<div class="dropdown show">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Category
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<div th:each="c:${categories}">
<a class="dropdown-item" href="#" th:text="${c.getCategoryName()}">Action</a>
</div>
</div>
推荐阅读
- javascript - Angular 7,Ngrx,ExpressionChangedAfterItHasBeenCheckedError
- applescript - 未来日期小程序不会触发
- delphi - Stacked and normal Bar Series on single Chart in Delphi
- authorize.net - Authorize.Net 中的付款问题 - E00027“信用卡收费:无效响应”
- c++ - 如何在另一个线程中关闭 MFC 模态对话框并获取对话框返回值?
- php - 在 WooCommerce 电子邮件上查找/编辑订单详细信息元文本
- c# - ExecuteNonQuery 是等待触发器完成还是在插入/更新完成后完成?
- javascript - 在 Angular 中按顺序运行组件
- html - 换行后将 p 宽度调整为文本
- ios - 验证 JWT 令牌签名