在我正在处理的当前项目中,模型 bean 在 3 个字段中有电话号码,但我们只想要一个弹簧验证错误。可以这样做吗>
@NotEmpty(message = "Your Question must not be blank.")
@Size(min = 10, max = 200)
private String content;
@NotEmpty(message = "Area Code must not be blank.")
@Size(min = 3, max = 3, message = "Area must be 3 numbers")
private String areacode;
@NotEmpty(message = "Phone Number must not be blank.")
@Size(min = 3, max = 3, message = "phone number first part must be 3 numbers")
private String phone3;
@NotEmpty(message = "Phone Number must not be blank.")
@Size(min = 4, max = 4, message = "Phone number last part must be 4 numbers")
private String phone4;