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.
I resolve my proplem with:
@DecimalMax("10.0") @DecimalMin("0.0")
private double score;
Thank you lots @ Kayaman ,@hyness
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With