添加属性编辑
import java.beans.PropertyEditorSupport;
import saas.crm.market.activity.model.ActivityType;
public class ActivityTypeEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(ActivityType.toType(text));
}
}
2.contoroller
@InitBinder("activity")
public void initBinder(WebDataBinder binder) throws Exception {
binder.registerCustomEditor(ActivityType.class, "type", new ActivityTypeEditor());
binder.registerCustomEditor(ActivityState.class, "state", new ActivityStateEditor());
}