java - Bean Validation with args condition -


let's assume situation.

i have length label. want show me message length must lower 5!, other time should show length must value between 2 , 5!. should depend on number of arguments pass this.

could done without using second label, instance length?

it can done without different values in property file.

for e.g. have label such:

my.label=length must lower 5!,length must value between 2 , 5! 

but not recommended. need split based on separator, comma in case, , handle logic yourself.

the clean solution be:

my.label.error.maxsize=length must lower 5! my.label.error.size=length must between 2 , 5! 

and of course value maxsize or size can set programatically.

edit:

the java implementation depends lot on framework used load values property files.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -