I want to check score which have value: 0.00 <= value<= 10.00
I used:
-Model(Score):
@Range(min = (long) 0.0, max = (long) 10.0) private double score;
-messages.properties:
Range.score.score=Please input 0<= score <=10
-servlet-context.xml:
<beans:bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <beans:property name="basename" value="messages" /> </beans:bean>
But the value = 10.01 has passed the check.
Please help me.
Advertisement
Answer
I resolve my proplem with:
@DecimalMax("10.0") @DecimalMin("0.0") private double score;
Thank you lots @ Kayaman ,@hyness