Hello,
can anybody give me some hints on the configuration of validators to avoid 
redundant configuration.

Lets say, you have 3 actions, all off them have a username field. To validate 
the username three build-in validators are used (with annotation or via xml). 
If the validation rule changes, all three actions (annotations or xml) must be 
changed.

My target is to define a custom validator. Then i can use the custom validator 
within the three ActionClasses. 
Inside the custom validator i want to invoke the build-in validators.

The best thing would be, if the custom validator can be defined via xml.

Example:

<groupvalidators>
        <groupvalidator group="username">
                <validator name="required"/>
                <validator name="regex">
                        <param name=expression>...</param>
                </validator>
                <validator name="stringlength">
                        <param name=maxlen>12</param>
                </validator>
        </groupvalidator>

        <groupvalidator group="password">
                <validator name="required"/>
                <validator name="regex">
                        <param name=expression>...</param>
                </validator>
                <validator name="stringlength">
                        <param name=minlen>5</param>
                </validator>
        </groupvalidator>
</groupvalidators>

The action uses the groupvalidator with parameter username or password.

Has anybody done something like this before and can give me some hints. 
Especially on calling validators inside a custom validator. Or are there any 
other solutions to define a set of validators, which can be used for different 
action classes.

Thanks 
Andi

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to