//Entity
public class MyEntity {
private Double amount;
public Double getAmount() { return this.amount; }
public void setAmount(Double value) { this.amount = value; }
}
//Controller
@RequestMapping(value="/save")
public void save(MyEntity a) {
//save to db
}
//
<input name="amount" value="1,252.00" />
当我登顶时,它一直返回400 - Bad Request
..我发现这是因为弹簧无法将格式化的数字转换为双精度数。如何将设置前的请求转换为MyEntity