Link to home
Start Free TrialLog in
Avatar of Cluniac
Cluniac

asked on

Error messages for Struts validation

I've got a question that I don't think is possible, but I want to make sure!

I have a form field that has a maxlength dependent on other options.  I have written my own validator to check that the length is valid - ( dependent on these other options) , and that works just fine.

Now to take it one step further, it would be ideal if I could have the error message that I have stored from ApplicationResources.properties  be chosen depending on these other options....

So instead of having a generic message: "The length is invalid" or something like that, it could actually say what the length required is.  I can't use the actual maxlength validator that does this, because of the way the fields are being used by multiple name codes.  

So is there a way to choose a different error message from within the validator class, or is it only possible to have one error message per validator, as entered in the validator-rules.xml?

Thanks!
Matt
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial