update:
I found the valication messages. This is from ValidationMessages.properties:
maximum-string-length=You may provide at most %d characters for %s.

This is from ValidationMessages_zh_CN.properties:
maximum-string-length=\u60a8\u6700\u591a\u80fd\u4e3a %s \u63d0\u4f9b\u81f3\u5c11 %d \u5b57\u7b26\u3002

So looks the order of %s and %d are reversed for zh_CN.

This is from ValidationMessages_zh_CN.properties of tapestry 5.2.6 and it looks very different with the one in 5.3.1: maximum-string-length = %2$s\u7684\u5185\u5BB9\u4E0D\u80FD\u8D85\u8FC7%1$d\u5B57\u7B26\u3002
----------
I didn't set any language in this test app. So tapestry might be using my locale(Chinese). Where can I find the default property setting for Chinese?

于 2012/3/8 18:14, Lance Java 写道:
What language are your error messages displaying in?

Perhaps there is a bad format in one of the language property files.

FYI, the validator is looking for a property named "maximum-string-length"

On Thursday, 8 March 2012, Lance Java<lance.j...@googlemail.com>  wrote:
Have you overridden the validation error message?

Tapestry is having troubles showing an error message and is trying to
push a string where an integer should go.
Somewhere in the validation error message, there is a %d where it should
be a %s.
On Thursday, 8 March 2012, Rural Hunter<ruralhun...@gmail.com>  wrote:
I just meet a strange error with MaxLength Validator with tapestry
5.3.1. My test page is vary simple(copied from jump start):
Page:
<form t:type="form" t:id="inputs">
<t:errors/>
<table>
<tr>
<td>aaa:</td>
<td><input t:type="TextField" t:id="firstName"
t:validate="maxlength=5"/></td>
<td>(required, maxLength=10, letters only)</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Display"/></td>
<td></td>
</tr>
</table>
</form>

Then the page run with error:
CreatingValidators1:firstname (class
org.apache.tapestry5.corelib.components.TextField)
context:CreatingValidators1.tml, line 17
12<form t:type="form" t:id="inputs">
13<t:errors/>
14<table>
15<tr>
16<td>aaa:</td>
17<td><input t:type="TextField" t:id="firstName"
t:validate="maxlength=5"/></td>
18<td>(required, maxLength=10, letters only)</td>
19</tr>
20<tr>
21<td></td>
22<td><input type="submit" value="Display"/></td>

org.apache.tapestry5.ioc.internal.util.TapestryException
d != java.lang.String

location
    context:CreatingValidators1.tml, line 17

java.util.IllegalFormatConversionException
d != java.lang.String

argumentClass
    class java.lang.String
conversion
    d
Filter stack frames Stack trace


  java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:3999)
  java.util.Formatter$FormatSpecifier.printInteger(Formatter.java:2709)
        java.util.Formatter$FormatSpecifier.print(Formatter.java:2661)
        java.util.Formatter.format(Formatter.java:2433)
        java.util.Formatter.format(Formatter.java:2367)
        java.lang.String.format(String.java:2813)

  
org.apache.tapestry5.ioc.internal.util.MessageFormatterImpl.format(MessageFormatterImpl.java:49)
  org.apache.tapestry5.validator.MaxLength.buildMessage(MaxLength.java:39)
        org.apache.tapestry5.validator.MaxLength.render(MaxLength.java:48)
        org.apache.tapestry5.validator.MaxLength.render(MaxLength.java:23)

  
org.apache.tapestry5.internal.services.FieldValidatorImpl.render(FieldValidatorImpl.java:56)
  
org.apache.tapestry5.internal.services.CompositeFieldValidator.render(CompositeFieldValidator.java:45)
  
org.apache.tapestry5.corelib.base.AbstractTextField.begin(AbstractTextField.java:167)
  
org.apache.tapestry5.corelib.base.AbstractTextField.beginRender(AbstractTextField.java)
I don't understand what happened internally. The same code works fine
with tapestry 5.2.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to