| 1. |
What Is The Purpose Of @validations Annotation? |
|
Answer» If you want to use several ANNOTATIONS of the same TYPE, these annotation must be NESTED within the @Validations() annotation. public class Employee EXTENDS ActionSupport{ @Validations( requiredFields = {@RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName = "customfield", message = "You must enter a value for field.")}, requiredStrings = {@RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "stringisrequired", message = "You must enter a value for string.")} ) public String getName() { return name; } } If you want to use several annotations of the same type, these annotation must be nested within the @Validations() annotation. public class Employee extends ActionSupport{ @Validations( requiredFields = {@RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName = "customfield", message = "You must enter a value for field.")}, requiredStrings = {@RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "stringisrequired", message = "You must enter a value for string.")} ) public String getName() { return name; } } |
|