JSF validateLength问题

时间:2010-05-10 17:36:08

标签: validation jsf

我有一个带有验证的输入字段来验证最大和最小长度

<h:inputText id="LABEL_ID" styleClass="textboxsmall" value="#{sampleDatatableBean.accessionLabelId}" maxlength="5">
    <f:validateLength minimum="4" maximum="5" />
</h:inputText>
<br/><h:message id="LABEL_ID_MSG" styleClass="errorMessage" for="LABEL_ID" />

验证但我得到以下信息:

  

“值小于允许的最小值{0}”

不应该用最小值替换{0}吗?不知道为什么它没有提升价值。有什么想法吗?

Version info:
myfaces-api-1.1.5.jar:
Manifest-Version: 1.0 
Archiver-Version: Plexus Archiver 
Created-By: Apache Maven 
Built-By: mrmaven 
Build-Jdk: 1.5.0_11 
Implementation-Title: API 
Implementation-Version: 1.1.6-SNAPSHOT 
Implementation-Vendor-Id: org.apache.myfaces.core 
Implementation-Vendor: Apache Software Foundation 

myfaces-impl-1.1.5.jar:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: mrmaven
Build-Jdk: 1.5.0_11
Implementation-Title: Impl
Implementation-Version: 1.1.6-SNAPSHOT
Implementation-Vendor-Id: org.apache.myfaces.core
Implementation-Vendor: Apache Software Foundation

应用服务器:jboss-4.0.5.GA

适用于

<f:validateLongRange   minimum="100"   maximum="999" />

固定 在ErrorMessages_en.properties文件中添加_detail后似乎可以正常工作。

javax.faces.validator.LengthValidator.MAXIMUM_detail = Value is longer than allowable 
maximum of {0} characters.

1 个答案:

答案 0 :(得分:0)

FIXED在ErrorMessages_en.properties文件中添加“javax.faces.validator.LengthValidator.MAXIMUM_detail”之后似乎可以正常工作。