struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gundersen, Richard" <Richard.Gunder...@london-scottish.com>
Subject RE: Brackets in validation.xml
Date Tue, 12 Dec 2006 15:01:07 GMT
Yup

That worked a treat

Thanks Chris!

-Richard

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Tuesday, December 12, 2006 2:55 PM
To: Struts Users Mailing List
Subject: Re: Brackets in validation.xml

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

Richard,

Gundersen, Richard wrote:
> Can anyone please tell me why this works. It's two versions of a
> validation rule from my commons validator xml file (for a validwhen
> condition):

The parser that the validation package uses cannot parse expressions of
the form "A or B or C" ("or" can be replaced with "and" anywhere, here).
They have a relatively simple expression syntax that only supports
binary logical expressions (although, without too much trouble, adding
right- or left-associativity for logical operators isn't really that
tough, and most programmers expect that kind of thing).

So, instead, you have to do this:

(A or B) or C

Looking at your "it doesn't work" scenario, you have the situation above
that I mentioned if you just call this "A":

((oldProductStatusId == 21) and ( (productStatusId == 21) or
(productStatusId == 23)))

and this "B":

 ((oldProductStatusId == 23) and ( (productStatusId == 23) or
(productStatusId == 22))) or

and this "C":

 ((oldProductStatusId == 23) and ( (productStatusId == 23) or
(productStatusId == 22)))

You need to wrap your first two logical combinations in yet another set
of parenthesis.

Hope that helps,
- -chris

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

iD8DBQFFfsK29CaO5/Lv0PARAgo7AJ0fnVh+txKFyhavKipygARIBnzOHQCghmmM
lcfyDekvb8qyLLMA1avH56A=
=Qhoz
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

*** Disclaimer *** 

This electronic communication is confidential and for the exclusive use of the addressee.
It may contain private and confidential information. The information, attachments and opinions
contained in this E-mail are those of its author only and do not necessarily represent those
of London Scottish Bank PLC or any other members of the London Scottish Group. 

If you are not the intended addressee, you are prohibited from any disclosure, distribution
or further copying or use of this communication or the information in it or taking any action
in reliance on it. If you have received this communication in error please notify the Information
Security Manager at ISM@London-Scottish.com as soon as possible and delete the message from
all places in your computer where it is stored. 

We utilise virus scanning software but we cannot guarantee the security of electronic communications
and you are advised to check any attachments for viruses. We do not accept liability for any
loss resulting from any corruption or alteration of data or importation of any virus as a
result of receiving this electronic communication. 

Replies to this E-mail may be monitored for operational or business reasons. London Scottish
Bank PLC is regulated by the Financial Services Authority.
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message