I have a form with several fields (ie a,b,c,d,...) and the project I am currently doing right now is using Annotations for form validation in Struts2. XML usage is being discouraged.
I need to check a certain condition before I will validate form elements b, c, and d.
I was able to do the following:
@Validations {
requiredStrings = {
@RequiredStringValidator(...),
@RequiredStringValidator(...),
}
}
public String doSomething(){
...
return SUCCESS;
}
Is there a way to do this in Struts2 Annotation alone? Most similar questions I have found in SO all tell me to use XML method. Thanks.
使用表达式验证器,或编写自定义验证器。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.