gigaZhang / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

validation #924

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
@Validations(requiredStrings={
        @RequiredStringValidator(fieldName="userId",type=ValidatorType.FIELD,message="UserId should not empty"),
        @RequiredStringValidator(fieldName="password",type=ValidatorType.FIELD,message="Password should not empty")
})
in one action i have to validate only userid and another method i have to 
validate userid and password how can i achieve it?

Original issue reported on code.google.com by soft.div...@gmail.com on 23 Nov 2012 at 10:21

GoogleCodeExporter commented 9 years ago
This is not an Issue for this Project. Please ask Struts2 related stuff at the 
Struts2 Mailing List.

public String processMyAction() {
// do the Logic
return "success";
}

@Validations(requiredStrings={
        @RequiredStringValidator(fieldName="userId",type=ValidatorType.FIELD,message="UserId should not empty"),
        @RequiredStringValidator(fieldName="password",type=ValidatorType.FIELD,message="Password should not empty")
})public String action1() {
return processMyAction();
}

@Validations(requiredStrings={
        @RequiredStringValidator(fieldName="userId",type=ValidatorType.FIELD,message="UserId should not empty")
})public String action2() {
return processMyAction();
}

Original comment by johgep on 10 Dec 2012 at 12:37