用于validateDateTimeRange的JSPX特立尼达的messageDetailNotInRange无法正常工作 [英] JSPX Trinidad messageDetailNotInRange for validateDateTimeRange not working

查看:111
本文介绍了用于validateDateTimeRange的JSPX特立尼达的messageDetailNotInRange无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试覆盖默认的 validateDateTimeRange 根据文档使用messageDetailNotInRange消息.

I am trying to override the default validateDateTimeRange message using messageDetailNotInRange as per the documentation.

尽管有我的代码,但验证器会生成默认错误消息:日期超出有效范围."有人可以在这里看到问题吗?

Despite my code, the validator produces the default error message: "The date is outside the valid range." Can anyone see something wrong here?

<tr:inputDate required="true"
              inlineStyle="color:rgb(0,58,117); font-weight:bold;"
              value="#{processScope.benefit.serviceDate}"
              immediate="false"
              onchange="submit();"
              label="#{mb_ResourceBean.res['claim.serviceDate.label']}">

  <tr:convertDateTime pattern="yyyy/MM/dd"
                      secondaryPattern="yyyyMMdd"
                      type="date"/>

  <tr:validateDateTimeRange minimum="#{bk_ClaimBean.minDate}"
                            maximum="#{bk_ClaimBean.maxDate}"
                            messageDetailNotInRange="The value of {1} exceeds the 30 day limitation to submit claim.  The service date must be within the previous 30 days."/>

</tr:inputDate>

推荐答案

您的代码看起来不错.您可以尝试使用另一种方法,并使用键org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.NOT_IN_RANGE将消息添加到项目的消息包中,以覆盖特立尼达的默认消息.

Your code looks OK. You could try a different approach and add message with the key org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.NOT_IN_RANGE to your project's message bundle to override Trinidad's default message.

如果您在项目中未使用消息包,则可以将其添加到faces-config.xml:

If you are not using a message bundle in your project you can add it to your faces-config.xml:

<application>
  <locale-config>
    <default-locale>en</default-locale>
    <supported-locale>en</supported-locale>
  </locale-config>
  <message-bundle>
    messages
  </message-bundle>
</application>

并将消息包的相应属性文件添加到应用程序资源中:

And add the corresponding properties file for your message bundle to your application resources:

messages.properties

如果使用的是Maven,请确保将资源文件夹添加(如果尚未存在)到pom.xmlbuild部分.

If you are using Maven, make sure you add (if it's not there already) the resource folder to the build section of your pom.xml.

<resources>
  <resource>
    <directory>src/main/resources</directory>
  </resource>
</resources>

以下是您可以在消息捆绑包中覆盖的所有可能消息的列表:

Here's list of all possible messages you can override in your message bundle:

org.apache.myfaces.trinidad.UIXEditableValue.REQUIRED=A value is required.
org.apache.myfaces.trinidad.UIXEditableValue.REQUIRED_detail=You must enter a value.
org.apache.myfaces.trinidad.UIXSelectMany.REQUIRED=A selection is required.
org.apache.myfaces.trinidad.UIXSelectMany.REQUIRED_detail=You must make at least one selection.
org.apache.myfaces.trinidad.UIXSelectOne.REQUIRED=A selection is required.
org.apache.myfaces.trinidad.UIXSelectOne.REQUIRED_detail=You must make a selection.
org.apache.myfaces.trinidad.UIXTableSelectOne.REQUIRED=A row selection is required.
org.apache.myfaces.trinidad.UIXTableSelectOne.REQUIRED_detail=You must select a row.
org.apache.myfaces.trinidad.UIXTableSelectMany.REQUIRED=A row selection is required.
org.apache.myfaces.trinidad.UIXTableSelectMany.REQUIRED_detail=You must select one or more rows.
org.apache.myfaces.trinidad.UIXSelectMany.UNSUPPORTED_MODEL_TYPE=Unsupported model type.
org.apache.myfaces.trinidad.UIXSelectMany.UNSUPPORTED_MODEL_TYPE_detail=SelectMany does not support a model of type {0}.
org.apache.myfaces.trinidad.UIXEditableValue.CONVERSION=The value is not the in correct format.
org.apache.myfaces.trinidad.UIXEditableValue.CONVERSION_detail=Enter a value that matches this pattern: {2}
org.apache.myfaces.trinidad.UPLOAD=The file is too large.
org.apache.myfaces.trinidad.UPLOAD_detail=The file could not be uploaded because it is too large.
org.apache.myfaces.trinidad.validator.RangeValidator.MAXIMUM_HINT=Enter a number less than or equal to {0}.
org.apache.myfaces.trinidad.validator.RangeValidator.MINIMUM_HINT=Enter a number greater than or equal to {0}.
org.apache.myfaces.trinidad.validator.RangeValidator.RANGE_HINT=Enter a number between {0} and {1}.
org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_HINT=Enter {0} or fewer characters.
org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_HINT=Enter {0} or more characters.
org.apache.myfaces.trinidad.validator.LengthValidator.EXACT_HINT=Enter {0} characters.
org.apache.myfaces.trinidad.validator.LengthValidator.RANGE_HINT=Enter between {0} and {1} characters.
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MAXIMUM_HINT=Enter a date on or before {0}.
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MINIMUM_HINT=Enter a date on or after {0}.
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.RANGE_HINT=Enter a date between {0} and {1}.
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.WEEKDAY_HINT=Enter a date that falls on one of the following days: {0}
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.MONTH_HINT=Enter a date from one of the following months: {0}
javax.faces.validator.LongRangeValidator.MINIMUM=The number is too low.
javax.faces.validator.LongRangeValidator.MINIMUM_detail=The number must be greater than or equal to {2}.
javax.faces.validator.LongRangeValidator.MAXIMUM=The number is too high.
javax.faces.validator.LongRangeValidator.MAXIMUM_detail=The number must be less than or equal to {2}.
javax.faces.LongRange=The number is not a whole number.
javax.faces.LongRange_detail=Enter a whole number.
org.apache.myfaces.trinidad.validator.ByteLengthValidator.MAXIMUM=The value is too long.
org.apache.myfaces.trinidad.validator.ByteLengthValidator.MAXIMUM_detail=Enter a value that is not more than {2} bytes long.
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MAXIMUM=The date is after the valid range.
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MAXIMUM_detail=The date must be on or before {2}.
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MINIMUM=The date is before the valid range.
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MINIMUM_detail=The date must be on or after {2}.
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.NOT_IN_RANGE=The date is outside the valid range.
org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.NOT_IN_RANGE_detail=The date must be between {2} and {3}.
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.DAY=The date is not valid.
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.DAY_detail=Enter one of the valid dates.
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.MONTH=Dates in this month are not valid.
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.MONTH_detail=Enter a date in one of the following months: {2}
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.WEEKDAY=The day of the week for this date is not valid.
org.apache.myfaces.trinidad.validator.DateRestrictionValidator.WEEKDAY_detail=Enter a date that is on one of the following days: {2}
org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MAXIMUM=The number is too high.
org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MAXIMUM_detail=The number must be less than or equal to {2}.
org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MINIMUM=The number is too low.
org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MINIMUM_detail=The number must be greater than or equal to {2}.
org.apache.myfaces.trinidad.validator.DoubleRangeValidator.NOT_IN_RANGE=The number is outside the valid range.
org.apache.myfaces.trinidad.validator.DoubleRangeValidator.NOT_IN_RANGE_detail=The number must be between {2} and {3}.
org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM=There are too many characters.
org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_detail=Enter {2} or fewer characters, not more.
org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM=There are too few characters.
org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_detail=Enter {2} or more characters, not fewer.
org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE=The number of characters is out of range.
org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE_detail=Enter {2} or more characters, up to a maximum of {3}.
org.apache.myfaces.trinidad.validator.LengthValidator.EXACT=The number of characters is incorrect.
org.apache.myfaces.trinidad.validator.LengthValidator.EXACT_detail=Enter exactly {2} characters.
org.apache.myfaces.trinidad.validator.LongRangeValidator.MAXIMUM=The number is too high.
org.apache.myfaces.trinidad.validator.LongRangeValidator.MAXIMUM_detail=The number must be less than or equal to {2}.
org.apache.myfaces.trinidad.validator.LongRangeValidator.MINIMUM=The number is too low.
org.apache.myfaces.trinidad.validator.LongRangeValidator.MINIMUM_detail=The number must be greater than or equal to {2}.
org.apache.myfaces.trinidad.validator.LongRangeValidator.NOT_IN_RANGE=The number is out of range.
org.apache.myfaces.trinidad.validator.LongRangeValidator.NOT_IN_RANGE_detail=The number must be between {2} and {3}.
org.apache.myfaces.trinidad.validator.RegExpValidator.NO_MATCH=The format is incorrect.
org.apache.myfaces.trinidad.validator.RegExpValidator.NO_MATCH_detail=The value must match this pattern: {2}
org.apache.myfaces.trinidad.convert.DateTimeConverter.DATE_HINT=Example: {0}
org.apache.myfaces.trinidad.convert.DateTimeConverter.TIME_HINT=Example: {0}
org.apache.myfaces.trinidad.convert.DateTimeConverter.BOTH_HINT=Example format: {0}
org.apache.myfaces.trinidad.convert.ColorConverter.FORMAT_HINT=Example format: {0}
org.apache.myfaces.trinidad.convert.NumberConverter.FORMAT_HINT=Example format: {0}
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_DATE=The date is not in the correct format.
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_DATE_detail=Enter a date in the same format as this example: {2}
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_TIME=The time is not in the correct format.
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_TIME_detail=Enter a time in the same format as this example: {2}
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH=The date and time is not in the correct format.
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_BOTH_detail=Enter a date and time in the same format as this example: {2}
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_DATE_INVALID_DATE=The date or time entered is not valid.
org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_DATE_INVALID_DATE_detail=Enter a valid date or time.
org.apache.myfaces.trinidad.convert.ColorConverter.CONVERT=The color is not in the correct format.
org.apache.myfaces.trinidad.convert.ColorConverter.CONVERT_detail=Enter a color in the same format as this example: {2}.
org.apache.myfaces.trinidad.convert.ColorConverter.TRANSPARENT=Transparent
org.apache.myfaces.trinidad.convert.IntegerConverter.CONVERT=The number is not a whole number.
org.apache.myfaces.trinidad.convert.IntegerConverter.CONVERT_detail=Enter a whole number.
org.apache.myfaces.trinidad.convert.IntegerConverter.MINIMUM=The number is too low.
org.apache.myfaces.trinidad.convert.IntegerConverter.MINIMUM_detail=The number must be greater than or equal to {2}.
org.apache.myfaces.trinidad.convert.IntegerConverter.MAXIMUM=The number is too high.
org.apache.myfaces.trinidad.convert.IntegerConverter.MAXIMUM_detail=The number must be less than or equal to {2}.
org.apache.myfaces.trinidad.convert.LongConverter.CONVERT=The number is not a whole number.
org.apache.myfaces.trinidad.convert.LongConverter.CONVERT_detail=Enter a whole number.
org.apache.myfaces.trinidad.convert.LongConverter.MINIMUM=The number is too low.
org.apache.myfaces.trinidad.convert.LongConverter.MINIMUM_detail=The number must be greater than or equal to {2}.
org.apache.myfaces.trinidad.convert.LongConverter.MAXIMUM=The number is too high.
org.apache.myfaces.trinidad.convert.LongConverter.MAXIMUM_detail=The number must be less than or equal to {2}.
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PATTERN=The format is incorrect.
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PATTERN_detail=The format of the number must match this pattern: {2}
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_NUMBER=The value is not a number.
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_NUMBER_detail=The value must be a number.
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_CURRENCY=The currency format is incorrect.
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_CURRENCY_detail=Enter a currency in the same format as this example: {2}
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PERCENT=The percentage is not in the correct format.
org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_PERCENT_detail=Enter a percentage in the same format as this example: {2}
org.apache.myfaces.trinidad.convert.ShortConverter.CONVERT=The number is not a whole number.
org.apache.myfaces.trinidad.convert.ShortConverter.CONVERT_detail=Enter a whole number.
org.apache.myfaces.trinidad.convert.ShortConverter.MINIMUM=The number is too low.
org.apache.myfaces.trinidad.convert.ShortConverter.MINIMUM_detail=The number must be greater than or equal to {2}.
org.apache.myfaces.trinidad.convert.ShortConverter.MAXIMUM=The number is too high.
org.apache.myfaces.trinidad.convert.ShortConverter.MAXIMUM_detail=The number must be less than or equal to {2}.
org.apache.myfaces.trinidad.convert.ByteConverter.CONVERT=The number is not a whole number.
org.apache.myfaces.trinidad.convert.ByteConverter.CONVERT_detail=Enter a whole number.
org.apache.myfaces.trinidad.convert.ByteConverter.MINIMUM=The number is too low.
org.apache.myfaces.trinidad.convert.ByteConverter.MINIMUM_detail=The number must be greater than or equal to {2}.
org.apache.myfaces.trinidad.convert.ByteConverter.MAXIMUM=The number is too high.
org.apache.myfaces.trinidad.convert.ByteConverter.MAXIMUM_detail=The number must be less than or equal to {2}.
org.apache.myfaces.trinidad.convert.DoubleConverter.CONVERT=The value is not a number.
org.apache.myfaces.trinidad.convert.DoubleConverter.CONVERT_detail=The value must be a number.
org.apache.myfaces.trinidad.convert.FloatConverter.CONVERT=The value is not a number.
org.apache.myfaces.trinidad.convert.FloatConverter.CONVERT_detail=The value must be a number.
org.apache.myfaces.trinidad.convert.ALERT_FORMAT={0} - {1}
org.apache.myfaces.trinidad.convert.ALERT_FORMAT_detail={0} - {1}
org.apache.myfaces.trinidad.event.FileDownloadActionListener.DOWNLOAD_ERROR=An error occurred downloading the file.
org.apache.myfaces.trinidad.event.FileDownloadActionListener.DOWNLOAD_ERROR_detail=The file was not downloaded or was not downloaded correctly.
org.apache.myfaces.trinidad.component.core.input.CoreInputFile.INPUT_FILE_ERROR=An error occurred uploading the file.
org.apache.myfaces.trinidad.component.core.input.CoreInputFile.INPUT_FILE_ERROR_detail=A file upload error has occurred, please verify your upload data and file name.

这篇关于用于validateDateTimeRange的JSPX特立尼达的messageDetailNotInRange无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆