【发布时间】:2021-06-05 03:43:02
【问题描述】:
我有一个下拉列表,客户端必须选择一个值,然后它将保留在 mysql db 好的,我这样做了,但是我想当客户选择一个值时,我得到该值并执行 if 语句 例子:
如果选择的值为:CIN 然后 compte.setcomptenumber(25364138); 像这样
这是我的控制器:
@RequestMapping(value="/addClient")
public String addClient (Model model) {
Client client= new Client();
Compte compte = new Compte();
Agence agence = new Agence();
//Carte carte = new Carte();
model.addAttribute("client",client);
List<String> typepieceList = Arrays.asList("CIN","Passeport");
return "client";
}
我的html:
<div class="p-col-12">
<label class="p1">Choisir Type de la pièce d'identité
</label> <br> <select th:field="*{typepieceClient}"
class="form-control" required="required">
<option value=""></option>
<option th:each="p: ${typepieceList}" th:value="${p}"
th:text="${p}" class="p1"></option>
</select>
</div>
【问题讨论】:
标签: spring spring-boot hibernate spring-mvc thymeleaf