mercredi 20 mai 2015

Dynamic Java Data Validation

I have a web application that allows user data entry via a Dynamically generated HTML5 Form

I am performing client side validation using HTML5 attributes such as required, etc with input types such as email, url.

I will also replicate this field validation on the server side.

I dont want to "hard Code" my validation as the data entry form fields are controlled via database reference data. I have a rich data model that describes each form and the data entry fields within them. This reference data includes data entry data types, e.g. text, numeric, whether or not the numeric value has an associated range; Lists are also defined as well as Dates, and formatted data such as telephone numbers, Tax identification etc.

I would also like to store Java Validation configuration details as part of this reference data.

What I am looking for is to be able to read a set of data entry fields from my database (along with its associated data validation rules) and execute these rules on the server side when the user clicks on submit and my web application receives the entered data as a MultivalueMap.

The Integer key maps directly to my database unique key field of each data entry field.

I am using Hibernate elsewhere in my application and the hibernate validator does allow xml configuration. However from what i can see the hibernate validator.xml file has to be on the class path.

This is not dynamic.

Is there a Java validation framework that allows dynamic configuration at run time? This will enable me to read each data entry fields validation rules in "real time" and write standard java methods that can validate any of my fields?




Aucun commentaire:

Enregistrer un commentaire