Java Spring自定义编辑器

Java Spring自定义编辑器,java,spring,spring-mvc,property-editor,Java,Spring,Spring Mvc,Property Editor,我已经向spring处理程序添加了自定义属性编辑器。它使用jspx页面上的一个属性,但不使用其他属性,因为它只输出Money类的toString public void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder) { binder.registerCustomEditor(Money.class, new MoneyPropertyEditor()); } 在js

我已经向spring处理程序添加了自定义属性编辑器。它使用jspx页面上的一个属性,但不使用其他属性,因为它只输出Money类的toString

public void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder) {
    binder.registerCustomEditor(Money.class, new MoneyPropertyEditor());
}
在jspx中,货币类型的属性被引用为:

<cat:input type="text" uiid="amount" bindpath="form.pack.amount"/>€
系统输出为:

getAsText money: Money:  Amount: 0.7, AsCents: 70
textValue: 0.7
所以-属性编辑器工作并被调用。但输入仍然保持字符串响应:
money:money:Amount:0.7,上升:70,而不是
0.7


还应该配置什么以便使用输出自定义属性编辑器?

问题已解决!实际上,在本例中PropertyEditor工作正常,字段后来被外部js修改。

在您尝试数据绑定的对象上是否有其他类型为
Money
的字段?是的,它们的引用方式基本相同
getAsText money: Money:  Amount: 0.7, AsCents: 70
textValue: 0.7