Constraints message in validator of play20

前端 未结 1 1254
悲&欢浪女
悲&欢浪女 2021-01-14 01:24

I would like to have a different message for a Constraints validator but i am wandering how to do.... example

@Constraints.Required
@Constraints.Pattern(\"\\         


        
相关标签:
1条回答
  • 2021-01-14 01:45

    As you wrote, you can use

    @Constraints.Required(message = "This is field required")
    @Constraints.Pattern(value = "\\d{1,6}", message = "This field must contain from 1 to 6 digits")
    public String thisIsAnInt;
    
    0 讨论(0)
提交回复
热议问题