You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Gundersen, Richard" <Ri...@london-scottish.com> on 2006/12/12 15:30:23 UTC

Brackets in validation.xml

Hi

 

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):

 

(

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

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

)

 

But this doesn't

 

(

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

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

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

)

 

Thanks

 

Richard


*** 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.

Re: Brackets in validation.xml

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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


Re: Brackets in validation.xml

Posted by Martin Gainty <mg...@hotmail.com>.
Hi Richard
Did you check JIRA for this bug?
https://issues.apache.org/struts/browse/WW?report=com.atlassian.jira.plugin.system.project:openissues-panel
Martin--
--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire.
----- Original Message ----- 
From: "Gundersen, Richard" <Ri...@london-scottish.com>
To: <us...@struts.apache.org>
Sent: Tuesday, December 12, 2006 9:30 AM
Subject: Brackets in validation.xml


Hi

 

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):

 

(

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

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

)

 

But this doesn't

 

(

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

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

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

)

 

Thanks

 

Richard


*** 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.