标签:
package com.ll.model;
import java.beans.PropertyEditorSupport;
public class PersonEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {
Person p = new Person();
if (text != null) {
String[] items = text.split(":");
p.setUsername(items[0]+"by propertyeEditor");
p.setPasswd(items[1]);
p.setRealName(items[2]);
p.setPrice(Double.parseDouble(items[3]));
}
setValue(p);
}
@Override
public String getAsText() {
return getValue().toString();
}
}
【Spring学习笔记-MVC-8.1】SpringMVC之类型转换@initBinder
标签:
原文地址:http://www.cnblogs.com/ssslinppp/p/4599436.html