Announcement Announcement Module
Collapse
No announcement yet.
error messages i18n Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • error messages i18n

    hello,

    my problem i don't know how bind error message in other lenguage.

    i have a jsp:
    Code:
      <spring&#58;bind path="command.user.dateIni">
        <FONT color="red">
          <B><c&#58;out value="$&#123;status.errorMessage&#125;"/></B>
        </FONT>
        <BR>
        <INPUT type="text" class="cajamin9" name="<c&#58;out value="$&#123;status.expression&#125;"/>" value="<c&#58;out value="$&#123;status.value&#125;"/>">
      </spring&#58;bind>
    in the form controller:
    Code:
      protected void initBinder&#40;HttpServletRequest request, ServletRequestDataBinder binder&#41; 
      &#123;
        SimpleDateFormat dateFormat = new SimpleDateFormat&#40;"dd/MM/yyyy HH&#58;mm"&#41;;
        dateFormat.setLenient&#40;false&#41;;
        binder.registerCustomEditor&#40;Date.class, null, new CustomDateEditor&#40;dateFormat, false&#41;&#41;;
      &#125;
    when i put a incorrect format date:
    Code:
    Failed to convert property value of type &#91;java.lang.String&#93; to required type &#91;java.util.Date&#93; for property 'cita.fechaIni'; nested exception is java.lang.IllegalArgumentException&#58; Could not parse date&#58; Unparseable date&#58; "1510/2004 09&#58;41"
    i have a fich messages_es.properties:
    Code:
    typeMismatch.date=formato fecha incorrecto
    typeMismatch.user.dateIni=formato fecha incorrecto
    why don't use the message?
    have i to do anything else?
    are there a list of error codes like typeMismatch to translate to other lenguage?

    thanks,
    CÚsar.

  • #2
    Try
    Code:
    typeMismatch.dateIni=formato fecha incorrecto
    The catch all should be:
    Code:
    typeMismatch.java.util.Date=formato fecha incorrecto

    Comment

    Working...
    X