You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Arnold, Patrick" <Pa...@iai.fzk.de> on 2006/11/28 13:40:31 UTC

Validator - Validation Rules at Runtime from DB

 Hi,

i'm working on a project, where attributes and entities are stored in
different tables. The reason therefore is, that attributes depend on the
type of an entity. e.g. For a lorry you may need an attribute
"load_in_kg", for a cabriolet this isn't very important, instead you
need the attribute "fun_factor". Such as this:

table "vehicle"
ID    name             vehicle_type_id
--------------------------------------------------
1    volvo g38         5
2    mercedes slk     6
3    dodge viper      7

table "vehicle_type"
ID   name
--------------------
5    lorry         
6    cabriolet
7    hellraiser

table "vehicle_attributes"
ID    name                vehicle_type_id    required
---------------------------------------------------------------------
1     load_in_kg         5                          yes
2     fun_factor         6                          yes
3     horsepower       6                          no
4     acceleration       7                          yes


My idea for validating the attributes dependent on the vehicle_type is
to read the attributes at runtime and generate a String which looks like
"validation.xml". Now i want to validate the form submission with this
XML-String. Is there a possibility to do this in the
SimpleFormController (Spring MVC) or has anyone a better approach to
come along with this problem?

Thanks in Advance,
Patrick