-1
我使用Spring啓動春天開機RequestParam類總是空
我的問題,當我發佈表單類(VehicleBrand等)始終爲空,但其他人(vinNumber,板)不爲空..
我該如何解決呢..
感謝
控制器
@Transactional
@PostMapping
String vehicleAddSubmit(
@RequestParam String plate,
@RequestParam String vinNumber,
@RequestParam VehicleBrand vehicleBrand
){
Vehicle vehicle = new Vehicle();
vehicle.setVehicleBrand(vehicleBrand);
vehicle.setEngineNumber(engineNumber);
vehicle.setVinNumber(vinNumber);
}
查看
<form th:attr="[email protected]{${#mvc.url('VC#vehicleAddSubmit').build()}}" method="post" class="form-horizontal">
<input type="text" class="form-control" name="plate" placeholder="Plaka"/>
<input type="text" class="form-control" name="vinNumber" placeholder="Şase"/>
<select id="vBrand" name="vehicleBrand" class="form-control">
<option value="">Marka Seçin</option>
<option value=""></option>
<option th:each="vBrand : ${vBrands}"
th:value="${vBrand.id}"
th:text="${vBrand.name}">
</option>
</select>
</form>