5

I have the following code:

<h:inputText id="it-date" value="#{myBean.myDate}">
    <f:convertDateTime pattern="MM/dd/yyyy"/>
</h:inputText>
<h:message for="it-date" />

When I enter the date 02/30/2012, I get the following message:

j_idt5:it-date: '02/30/2012' could not be understood as a date. Example: 10/01/2012 

Is it possible to remove j_idt5:it-date: including the colon and to keep the default message from Java?

I already tried to use the attribute label, but with that the colon remained. I don't want to use a custom message, because the default messages are already internationalized.

Abbadon
  • 2,513
  • 3
  • 25
  • 33
daff
  • 103
  • 1
  • 1
  • 8

1 Answers1

0

I guess you will need to get in between the message handling somehow to remove the colon because it is a fixed part of the message.

Checkout the message properties file, e.g. here: http://grepcode.com/file/repo1.maven.org/maven2/com.sun.faces/jsf-api/2.1.7/javax/faces/Messages.properties

The specific message/property in this case would be: javax.faces.converter.DateTimeConverter.DATE={2}: ''{0}'' could not be understood as a date.

Check out the fixed colon after the {2} . If you want to get rid of it but keep the actual message you would need some way to get in between the message handling.

Mabye this answer from BalusC is an option: FacesMessage listener

Community
  • 1
  • 1
Jens
  • 6,243
  • 1
  • 49
  • 79
  • @Abbadon: Thx for pointing out. Jarvana seems to down (currently). I exchanged the link to point to grepcode.com – Jens Apr 04 '14 at 09:17