Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: Validator error what does this mean?

Christopher Schultz

2007-01-02

Replies:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thomas,

Hehl, Thomas wrote:
> I'm still pretty new to struts and am taking over an app from a previous
> developer. I have added some validation and got the following error:
>
> ValidWhen Error for field ' additionalInfo' - line 1:18: unexpected token: )
>
> Here is the code from Validator-defaults.xml
>
> <form name="DisqualForm">    
>  <field property="email" depends="required, email">
>    <arg0 key="eJuror.global.label.from"/>
>  </field>    
>  <field property="additionalInfo" depends="validwhen">
>     <arg0 key="ejuror.global.label.additionalInfo"/>
>      <var>
>       <var-name>test</var-name>
>       <var-value>((remarksRequired) or (*this* != null))</var-value>
>      </var>
>   </field>
> </form>

The expression language for "validwhen" tests is very limited. The
sub-expression (remarksRequired) is invalid because there is no
comparison. I assume that you want something like this:

((remarksRequired == 'true') or (*this* != null))

If you want to compare "remarksRequired" to a specific value, you should
do so as indicated above. If you only want to test for it's existence,
then you can use "remarksRequired != null".

Hope that helps,
- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFFms2m9CaO5/Lv0PARAv9DAJd41+fXz/F4Srg03s4Ru96eowesAKCBMbsH
DoErYaqB+xSlzbg44uObHA==
=fa3V
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.