资 源 简 介
After applying the JSR-303 Bean Validation annotations to your Struts ActionForm subclass, performing a JSR-303 bean validation is just making a simple call in your ActionForm validate method as shown below when using sbva:
```
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.googlecode.sbva.DefaultStrutsBeanValidationAdapter;
import com.mycompany.Minimal;
import com.mycompany.SecondStep;
public class UserForm extends ActionForm {
private static DefaultStrutsBeanValidationAdapter beanValidationToStrutsConverter =
new DefaultStrutsBeanValidationAdapter();
...
@NotNull(groups = Minimal.class)
@Size(max=50, groups=FirstStep.class)
private String street1;
@NotNull(groups=SecondStep.class)
private String city