Valide validation in Java

Note: When using @NotBlank, it must be used with @Valid, otherwise it will not work

@NotBlank is used on String type

@NotNull is used on primitive types

@NotEmpty is used on collection classes

Use when adding custom error information:
result.addError(new ObjectError("xxx","xxxxxx"));
or
result.rejectValue("xxx", "xxxx", "xxxxxxx");

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324831754&siteId=291194637