خرید بک لینک

Vote count: 0

I'm working on a java spring mvc application. I have a model and I set two validation aotation on top of a field. Here is a code sample:

public class MyModel{

   @NotBlank(message = "This field can not be blank")
   @Size(max = 20, message = "Maximum size is 20")
   private String name;

   ....

}

When I left name empty and submit the form, error validation array has two members:

name => This field can not be blank
name => Maximum size is 20

But, I don't want second line. In fact, I want to when first validation on a field fails, all other validation on that field stop executing. How can I do this?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 15 فروردين 1395 ساعت: 14:42

صفحه بندی