Answer the question
In order to leave comments, you need to log in
What is the difference between @NotEmpty, @NotBlank and @NotNull?
I'm doing form validation in Spring using javax validation
But something didn't get the difference between annotations ,
and
?
Oh, and even in the Oracle documentation I came across this code :
public class Name {
@NotNull
@Size(min=1, max=16)
private String firstname;
@NotNull
@Size(min=1, max=16)
private String lastname;
...
}
and here I have a question, why use
if we have
in which the minimum length is set ( min=1 ) ?
Answer the question
In order to leave comments, you need to log in
String name = null;
NotNull = false
NotEmpty = false
NotBlank = false
String nam = "";
NotNull = true
NotEmpty = false
NotBlank = false
String name = " ";
NotNull = true
NotEmpty = true
NotBlank = false
String name = "zojian"
NotNull = true
NotEmpty = true
NotBlank = true
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question