JSR 303 Bean Validation + Javascript Client-Side Validation

后端 未结 7 1129
感情败类
感情败类 2021-01-30 20:48

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 currentl

相关标签:
7条回答
  • 2021-01-30 21:25

    I found this open source project but it looks dead, maybe it is worth resurrecting.

    http://kenai.com/projects/jsr303js/pages/Home

    This library provides client side validation of an HTML form based on JSR-303 and Hibernate Validator annotations, integrated with Spring MVC. The library provides a JavaScript validation code base that handles basic interaction with HTML forms, as well as JavaScript functions implementing the validation annotations supported by Hibernate Validator (including those not from the JSR-303 spec). This JavaScript code base can be included in a page by using a provided taglib or by extracting the JavaScript file from the jar and including it using a tag. Once this code base has been included in a page, a second taglib is used to generate the JavaScript code for validating an HTML form. You can also provide a JSON object in the body of the tag to specify additional configuration information.

    0 讨论(0)
提交回复
热议问题