Someone resolve this issue, or definitely is a bug??? Two @Validations
for different methods. (No execute method).
Hi again, and thank you for your answer.
I've tried using @Validations at the method level as you point out. I'll
try to illustrate:
I have an action, not annotated with @Validation, with three action
methods; input, execute and confirm (custom action method).
The input method has no annotations and is not validated as expected.
The execute method is annotated with @Validations:
@Validations(requiredStrings={
@RequiredStringValidator(fieldName="amount",
message="Amount is required", key="amount.required") }, regexFields={
@RegexFieldValidator(fieldName="amount", expression="^\\d+$",
message="Amount has to be numeric", key="amount.numeric") }) public
String execute() throws Exception {
...
}
The confirm method is also annotated with @Validations:
@Validations(expressions={ @ExpressionValidator(expression="confirm ==
true", message="test") }) public String confirm() throws Exception {
...
}
And here comes the confusing part. When I call my action with no method
name indicator (say MyAction, not MyAction_confirm), both fields (amount
and
confirm) is validated. I just want to validate "amount" when execute is
called and only the field "confirm" when the confirm method is called.
What am I doing wrong?
Manuel Correa.