Have anybody realized how editors and jsr 303 validation work with GWT 2.3 coming? Validation API was add to gwt sdk. But I am unable to validate entities using the editor frame
The Validation API, at least as of 2.3, doesn't build client side code for you – it is a tool that can be integrated on the server to make your server spit back errors in certain cases.
The call to EditorDriver.hasErrors()
is just to check if any code has told the local delegates if there are errors – client-side validation can be implemented through this.
The most automatic case right now is when using RequestFactory - if you have the javax.validation jar (both api and sources) on your server classpath as well as a validation library (hibernate-validator and apache's bval are two such libraries), the Receiver callback will have onViolation
called.
With RequestFactory being used to get violations from the server, the RequestFactoryEditorDriver
can then be used to push errors to the UI, though the use of HasEditorErrors
editor instances and wrappers, like ValueBoxEditorDecorator
, or just by notifying the user through some mechanism (alert, banner, your debug sys.out.println, etc) when onViolation
is called.
If using RPC, you can run the server validations on your own, and (as of 2.3) call driver.setConstraintViolations
with the ConstraintViolation
objects generated on the server from the validation process.