JSR 303 Bean Validation + Javascript Client-Side Validation

Taylor Leese picture Taylor Leese · Mar 25, 2010 · Viewed 11.3k times · Source

What is the best way to perform client-side form validation using Javascript (with minimal code duplication) when using JSR 303 bean validation on the server side? I'm currently using Spring 3 and the Hibernate Validator.

Answer

Hans Westerbeek picture Hans Westerbeek · Mar 25, 2010

I would suggest that you look at Spring JS, which relies heavily on Dojo. A tutorial can be found here.

Easiest way for yourself to start playing with it is to download Spring Roo, create the petclinic sample application with one of the example-scripts (this takes you 5 minutes) and then play around with how the javascript is integrated. Spring Roo creates an app with the same technology stack that you use (Spring+hibernate+implementation of jsr 303)