In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
What are the common notes in Validator, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Description
Validator mainly verifies the reasonableness of the data submitted by users, such as whether it is empty, whether the password length is greater than 6 digits, whether it is purely numeric, and so on. So how do you use such a powerful validation framework in spring boot?
Commonly used [@ null] (https://my.oschina.net/u/561366) verifies that the object is empty [@ notnull] (https://my.oschina.net/notnull) verifies that the object is non-empty @ asserttrue verifies that the boolean object is true [@ assertfalse] (https://my.oschina.net/u/2430840) verifies that the boolean object is false [@ min] (https://my.) Oschina.net/peterlv) verify that the number and string objects are large equal to the specified value @ max verify that the number and string objects are small equal to the specified value @ decimalmin verify that the number and string objects are large equal to the specified value Decimal existence precision @ decimalmax verifies that the number and string objects are small and equal to the specified value Decimal exists precision @ size validation object (array,collection,map String) whether the length is within the given range @ digits verifies that the composition of number and string is legal @ past verifies that date and calendar objects are before the current time @ future verifies that date and calendar objects are after the current time @ pattern verifies that string objects conform to the rules of regular expressions @ Email verifies that the actual mailbox example @ size (min=3, max=20) Message= "username length can only be between 3-20") @ size (min=6, max=20, message= "password length can only be between 6-20") @ pattern (regexp= "[a-za-z0-9.9% password -] + @ [a-za-z0-9.9 -] +\. [a-za-z] {2jue 4}", message= "email format error") @ Length (min= 5, max=20) Message= "username length must be between 5 and 20") @ Email (message= "such as entering the correct mailbox") @ NotNull (message= "user name cannot be empty") @ Max (value= 100, message= "cannot be older than 100years") @ Min (value= 18, message= "must be 18 years old!" ) @ AssertTrue (message= "bln4 must is true") @ AssertFalse (message= "blnf must is falase") @ DecimalMax (value= "100", message= "decim maximum is 100") DecimalMin (value= "100", message= "decim minimum value is 100") @ NotNull (message= "ID card cannot be empty") @ Pattern (regexp= "^ (\ d {18 minus 18} |\ d {15 jigma 15} | (\ d {17gr 17} [x | X])) $" Message= "ID card format error") is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.