1: @ NotBlank the annotations without me now, why display is deprecated
2: the first method in parameter user1 will be automatically add to the ModelAndView, not need new a ModelAndView object to call the addAttribute () method can be passed on to the next page?
The second method of User1 object why must call User1 and not other name? I understand probably because for springmvc injected object will automatically write hump gets smaller as the default name, but this method is not accept the form of the cords? What's the relationship between the automatic injection and
?
3: what th the contents of the label? I did not understand, in the first visit "page1" path in order to prevent abnormal, so may refer to the th middle finger is user1 object, but when the form validation error, th label became BindingResult key value of a class (see tutorial, so I write, I also don't know right, so what is it this content
Really don't understand, poor foundation, hope everybody to give directions
CodePudding user response:
1. Hibernate 6. X, (org. Hibernate. The validator) @ NotBlank under the package, @ NotEmpty was removed, if want to use the validation annotations, you can use (javax.mail. Validation. Constraints) @ NotBlank under the package, @ NotEmpty, (org. Hibernate. The validator) calibration entity class defines the attributes of a set of specifications, (javax.mail. Validation. Constraints) implement the specification,Found on the Internet,
2. Springboot receives the HTTP request parameters, automatic filling into the parameter, which is about User1 class if you have and request parameters consistent, automatically loaded into the class, we just tend to use the default name to name, but not mandatory,
@ NotBlank needs and @ Valid use together, will be at @ Valid check whether your parameter is null,
3. Don't know much about this way, I'm sorry, I'm sorry, but,
CodePudding user response: