当前位置:网站首页>@Detailed explanation of valid annotation usage
@Detailed explanation of valid annotation usage
2022-06-25 06:18:00 【WD Technology】
First of all we have Employee The properties of the class are annotated as follows :
package com.zyq.beans;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
/**
* The employee object
*
* @author sunnyzyq
* @since 2019/12/13
*/
public class Employee {
/** full name */
@NotBlank(message = " Please enter name ")
@Length(message = " Names cannot exceed {max} character ", max = 10)
public String name;
/** Age */
@NotNull(message = " Please enter age ")
@Range(message = " The age range is {min} To {max} Between ", min = 1, max = 100)
public Integer age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
}
And then again Controller On the corresponding method , Mark the employee with @Valid annotation , Indicates that we need to verify the properties of this object 
边栏推荐
- C simple operation mongodb
- Laravel8 fill data
- C switch nested syntax
- JS implementation mouse can achieve the effect of left and right scrolling
- Forecast report on output demand and supply scale of global and Chinese structural ceramics market for semiconductor equipment (2022 Edition)
- SAP ui5 application development tutorial XXIX - Introduction to routing and navigation functions of SAP ui5 trial version
- SAP ui5 beginner tutorial 25 - using proxy server to solve the cross domain problem of SAP ui5 application accessing remote OData service trial version
- Research Report on demand and Competitive Prospect of global and Chinese welding personal protective equipment industry 2022-2027
- How the sap ui5 framework performs single step debugging of batch requests
- How often should you refactor- How often should you refactor?
猜你喜欢
SAP ui5 tutorial for beginners part XXVI - detailed steps for using OData service with mock server trial version

【LeetCode】40. Combined summation II (2 strokes of wrong questions)
Yunda's cloud based business in Taiwan construction 𞓜 practical school

MySQL uses the where condition to find strange results: solve

Digitalization, transformation?
![[Suanli network] problems and challenges faced by the development of Suanli network](/img/90/1d537de057113e2b4754e76746f256.jpg)
[Suanli network] problems and challenges faced by the development of Suanli network

Day22 send request and parameterization using JMeter
![[network security] sharing of experience and ideas of an emergency battle](/img/9b/dd6e47ad7610eefd2b8c93602d6a7e.jpg)
[network security] sharing of experience and ideas of an emergency battle
Linus' speech recordings, which were lost in 1994, were made public
![[road of system analyst] collection of wrong questions in the chapters of Applied Mathematics and economic management](/img/62/dab2ac0526795f2040394acd9efdd3.jpg)
[road of system analyst] collection of wrong questions in the chapters of Applied Mathematics and economic management
随机推荐
What happens when redis runs out of memory
Aiot project that is an introduction to the basics of the Internet of things and can be implemented in practice
Monitoring access: how to grant minimum WMI access to the monitoring service account
What is the IP address
Hands on deep learning (III)
What is hybrid web containers for SAP ui5
Soft exam information system project manager_ Information system security management - Senior Information System Project Manager of soft test 026
How to open an account online? Is it safe to open an account online?
Lesson 9: workspace introduction
Tencent and China Mobile continued to buy back with large sums of money, and the leading Hong Kong stocks "led" the market to rebound?
Asemi fast recovery diode us1m parameters, us1m recovery time, us1m voltage drop
Cnpm installation
Mongodb basic concept learning - set
Observation configuring wmic
delphi-UUID
Use generator-easy-ui5 to quickly create the engineering structure of SAP ui5 applications
Gavin's insight on transformer live class - line by line analysis and field experiment analysis of insurance BOT microservice code of insurance industry in the actual combat of Rasa dialogue robot pro
Curl command – file transfer tool
CST8227
Guess the size of the number