Java Mailing List Archive

http://www.junlu.com/

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

Re: Validation rule writing

Christopher Schultz

2006-12-15

Replies:

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

Thom,

Thom Burnett wrote:
> I'm trying to validate two fields - area code and phone number (as nnn-nnnn
> no areacode in that input).
>
> [snip]
>
>       <constant-name>phoneFormatMask</constant-name>
>       <constant-value>^[0-9]{3}-[0-9]{4}$</constant-value>

This regexp looks good. Have you checked the docs for the regexp engine
used by the validator (is it Jakarta-ORO?) to make sure that the syntax
you are using is correct? You may have to use [0-9][0-9][0-9] instead of
[0-9]{3}, for instance.

>       <var>
>        <var-name>phoneMask</var-name>
>        <var-value>${phoneFormatMask}</var-value>
>       </var>

Have you tried putting the mask directly into the <var-value> element?
This would help you verify that your mask is working, even if your
configuration isn't 100% correct (i.e. the use of the 'constant' fields
might not be working).

Hope that helps,
- -chris

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

iD8DBQFFgtQE9CaO5/Lv0PARAu/yAKCMR7YwcuX+BBQ+/D7DX/e04dS+0QCeLlSz
9/TG4qqBX7xgXJW8YKPKX68=
=L1kC
-----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.