我遇到了与 RequestFactory 和 Editors 一起使用的 GWT 客户端验证的问题。
编辑代码是:
LocalityRequest localityContext = //create Request
Locality locality = //Locality Entity Proxy loaded from the server
driver.edit(locality, localityContext); //Edit the proxy
request = localityContext.updateLocality(locality);
保存代码是:
this.localityContext = (LocalityRequest) driver.flush(); //Flush the request
Set<ConstraintViolation<LocalityProxy>> violations = validator.validate(this.locality); //Local validate the object
if (!violations.isEmpty()) {
Set<ConstraintViolation<?>> sets = new HashSet<ConstraintViolation<?>>(violations);
driver.setConstraintViolations(sets);
editLocalityView.setErrors(sets); //give errors to the editors
return;
}
localityContext.fire(); //else send the request
我的问题是本地验证总是在加载的版本上验证,而不是用户版本的编辑。我们如何才能获得保存在请求中的刷新对象?
谢谢