struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakub Milkiewicz" <>
Subject Re: internalization validation.xml
Date Sat, 03 Jun 2006 21:32:34 GMT
Nobody answered me, so i decided to find a solution myself...
If you want to have UTF-8 characters support in string literals (like in
example i gave in previous mail), and you are not interestested in having
utf8 support in identifiers (like UTF8 characters in property names) you
need to follow the steps:
1. get struts sources.
2. in org\apache\struts\validator\validwhen directory there is
ValidWhenParser.g file that is used to generate lexer and parsers (antlr
Find class ValidWhenLexer extends Lexer line and add extra line in options :
charVocabulary = '\u0001' .. '\uFFFE';
I am using struts 1.2.8  so after modyfication it looks like following:
class ValidWhenLexer extends Lexer;

options {
 charVocabulary = '\u0001' .. '\uFFFE';
As far as i know antlr in version 2.7.2 supports UTF-8 characters from range
: '\u0001' - '\uFFFE'.
3. readme.txt contains instructions how to generate new
ValidWhenParserTokenTypes.txt files.You can use  as it is
from struts distribution but remember to modify it to make it use these new
generated files - modify imports.
4. The last thing it to modify validation-rules.xml to instruct struts to
use new validwhen validator i.e. to point it to our modified
I hope it will help someone...

2006/5/28, Jakub Milkiewicz <>:
> Hi
> I am using struts validator to validate my form. I have a problem with
> validwhen when i use non english characters in comparison section.
> I tried:
>             <field property="documentIdentity"
> depends="required,validwhen" page="1">
>                 <var>
>                     <var-name>test</var-name>
>                     <var-value>(*this* == 'dowód')</var-value>
>                 </var>
>             </field>
> or
>             <field property="documentIdentity"
> depends="required,validwhen" page="1">
>                 <var>
>                     <var-name>test</var-name>
>                     <var-value>(*this* == 'dow&#x00f3;d')</var-value>
>                 </var>
>             </field>
> But still it doesn't work.I always got a message on my console :
> 594cb546 ValidWhen     E org.apache.struts.validator.validwhen.ValidWhen
> ValidWhen Error for field ' documentIdentity' - line 1:16: expecting ''',
> found 'ó'
> I use struts 1.2.9, which is shipped vith validator 1.1.4
> Can anyone help me.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message