Hibernate Validator - @Length - How to specify separate message for min and max?

后端 未结 3 565
庸人自扰
庸人自扰 2021-02-04 02:41

I am using Hibernate validator for form validation in my web-app. I am using the @Length annotation for my String attribute as follows:

@Length(min = 5, message         


        
3条回答
  •  感情败类
    2021-02-04 03:09

    According to documentation, you can use @Length(min=, max=), with one message. Then just change your message to "The field must be between 5 and 50 characters"

提交回复
热议问题