0

I want to show a custom message when user insert a wrong input for a Double value but when i test my application i always see the default error message.

That's my custom messages.properties:

`javax.faces.convert.DoubleConverter.CONVERSION=My Conversion Error(Double)
javax.faces.convert.DoubleConverter.CONVERSION_detail=My Conversion Error(Double)
javax.faces.component.UIInput.CONVERSION=My Conversion Error
javax.faces.component.UIInput.CONVERSION_detail=My Conversion Error(Double)
javax.faces.validator.NOT_IN_RANGE=My Validation Error
javax.faces.validator.NOT_IN_RANGE_detail=My Validation Error
javax.faces.validator.DoubleRangeValidator.LIMIT=Validation Limit Double
javax.faces.validator.DoubleRangeValidator.LIMIT_detail=Validation Limit Double
javax.faces.validator.DoubleRangeValidator.TYPE=Error Type Double
javax.faces.validator.DoubleRangeValidator.TYPE_detail = Error Type Double
javax.faces.component.UIInput.REQUIRED=Requested!!
`

And here my faces.config

`<application>
<message-bundle>it.exaple.messages.MyMsg</message-bundle>
</application>`

And here my page:

`<td>
<h:inputText id="Value" value="#{user.value}" required="true">
<f:validateDoubleRange minimum="0.0" maximum="200.0"/></h:inputText>
<h:message for="username" showDetail="true" showSummary="true" style="color:red"/>
</td>`

It's really strange because when i test my application with an empty value i can read my customized message, but when i try to insert a string i see the default error message!! Same thing happen when i put a to high or too low value!

Anyone can help me? Thanks!

Babez21584
  • 93
  • 1
  • 1
  • 6
  • `it.exaple.messages.MyMsg` did you mean "example"? – Neil Apr 19 '12 at 11:00
  • yes..i mispelled the name of the class but i am sure that is used by my application because when i test with an empty value i can read my custom error message! – Babez21584 Apr 19 '12 at 11:03

1 Answers1

0

I hope you must override these default message to validate range of double. And I hope you have defined user.value as double in your managed bean.

javax.faces.validator.DoubleRangeValidator.MAXIMUM
javax.faces.validator.DoubleRangeValidator.MINIMUM
javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE
Ahamed Mustafa M
  • 3,069
  • 1
  • 24
  • 34