java如何对两个动作方法使用相同的验证方法
我在Struts2中有一个用于此方法的操作方法和验证方法。我想将此验证方法用于另一个操作方法。我不知道怎么做。请帮忙。该场景描述如下:
public class ApplicantRegistrationDetails extends ActionSupport {
public String personOfCollectiveTrademark() {
// some code..
}
public String insertAndValidateIECcode(){
// I have to use same validation method
// for this method as above.
}
//validation
public void validatePersonOfCollectiveTrademark() {
// validations for first method
}
}
# 1 楼答案
通过使用基于前缀的方法验证,您可以很容易地做到这一点