【发布时间】:2012-11-09 21:14:25
【问题描述】:
我正在使用 GWT 编辑器和 javax 验证。
我有一个带有这样子 bean 的模型 bean ->
public interface BeanA {
@Valid
BeanB getBeanB();
void setBeanB(BeanB b);
}
public interface BeanB {
@NotEmpty
public String getValue();
public void setValue(String value);
}
有一个 Widget 实现了 LeafValueEditor、HasEditorErrors 接口。
该值似乎没有问题。
public class MyWidget extends Composite implements
LeafValueEditor<String>, HasEditorErrors<String>{
...
@Override
public void showErrors(List<EditorError> errors) {
// Even though the error is flagged
// the errors collection does not contain it.
}
}
当我调用 validate 并且小部件 getValue 返回 null 时,ConstraintViolation 集合包含错误,但当调用 showErrors 时,List 为空。
知道为什么发现违规但没有出现在小部件 showErrors 中吗?
【问题讨论】:
-
我遇到了同样的问题。你能解决这个问题吗?
标签: validation gwt