I am trying to use JSR-303 bean validation.
I added the maven dependency
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
I put ValidationMessages_es.properties
and ValidationMessages_en.properties
in /WEB-INF/classes
.
This is the model:
@Pattern(regexp="[0-9]", message="{not.a.valid.number}")
private Double price;
And this is the view:
<p:inputText id="price"
value="#{inventoryMB.product.price}">
<f:convertNumber type="number" maxFractionDigits="0" />
</p:inputText>
<p:message for="price" />
When I put an invalid number I get this message from the validator:
form:price: 'ss' is not a number. Example: 99
My custom messages from the properties are not working. What is wrong?