【发布时间】:2018-02-18 15:45:31
【问题描述】:
我有一个 Thymeleaf 模板
<input type="text" th:field="*{purchasePrice}" ../>
映射到这个属性:
private float purchasePrice;
但我有这个错误:
Failed to convert property value of type java.lang.String to required type float for property purchasePrice; nested exception is java.lang.NumberFormatException: For input string: "0,132872"
我也试过
Failed to convert property value of type java.lang.String to required type float for property purchasePrice; nested exception is java.lang.NumberFormatException: For input string: "0.132872"
我也试过<input type="text" th:field="${purchasePrice}" .../>
但是我收到了这个错误
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'purchasePrice' available as request attribute
【问题讨论】:
标签: spring spring-mvc spring-boot thymeleaf