0
我有我的课域地图类域
class domain Factura {
String name
BigDecimal value
}
在我的html:
<g:form>
<input type="text" name="name" />
<input type="number" step="any" name="value" />
<inpu type="submit" value="save" />
</g:form>
在我的控制器
def save(Factura factura) {
//Suppose in the value I have put : 152.36
println "valor: " + factura.value => return 15236.0
//Suppose in the value I have put : 152,36
println "valor: " + factura.value => return 15236.0
}
我怎样才能返回作为十进制?我需要152.36
你可以使用@BindUsing anno以确保您的表单与实体的绑定按照您的预期完成。 ref(Grails 3.1):http://docs.grails.org/3.1.x/guide/theWebLayer.html#_the_bindusing_annotation – bassmartin