I am using @Digits now on a JPA entity. This is a Seam2.0.0.GA app on JBoss4.2.1.GA.
The following xhtml snippet works properly with @Length on the getter method in the entity:
Code:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:s="http://jboss.com/products/seam/taglib"
template="layout/template.xhtml">
<ui:define name="body">
<h:form>
barcode:
<h:inputText value="#{tbHardware.coxBarcode}" required="true">
<s:validate/>
</h:inputText>
<h:commandButton value="submit"/>
</h:form>
<h:messages globalOnly="false" styleClass="message"/>
</ui:define>
</ui:composition>
The @Digits validator does not work properly (e.g. if I enter "efg" in the inputText, I should see the err msg in h:messages component).
entity:
Code:
@Entity
@Table(name = "tbHardware")
@Name("tbHardware")
public class TbHardware implements java.io.Serializable {
...
@Column(name = "CoxBarcode", nullable = false, length = 200)
//AS 05-08-08 - moving some validations for barcode here from SFSB processValueChange()...
@Length(max=5, min=5, message="INVALID FORMAT - PLEASE ENTER A NUMERIC BARCODE (EX: 01234)")
@Digits(integerDigits=5, message="PERMITTED BARCODE LENGTH MUST BE 5")
public String getCoxBarcode() {
return this.coxBarcode;
}
public void setCoxBarcode(String coxBarcode) {
this.coxBarcode = coxBarcode;
}
...
}
what's the problem here or is this a bug? There's nothing interesting in the server.log (i.e. no errors). thx.