You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Gordon <ad...@readytalk.com> on 2006/07/14 16:50:44 UTC

Re: Compare two strings in Validator frame work]

For basic string validation you can do the following:

Use the "validwhen" attribute value for the "depends" attribute on the 
<field> element.  I.e.:

        <field property="oaSpeakerTollFreeNumber" depends="validwhen">
          <arg position="0" key="your.i18n.property.key"/>
          <var>
            <var-name>test</var-name>
            <var-value>(propertyName == "someValue")</var-value>
          </var>
        </field>

Where "propertyName" is the value of the "property" attribute for the 
item in your JSP.

Note that the <var-value> element will support logical and/or using the 
keyword "and" and "or" to join sections.  Note also that you must 
surround your boolean expression with parend and if you do use the 
logical operators, they are limited to two (2) boolean expressions, i.e. 
((property1 == "foo") or (bar >= 17))

For anything more complex, Paz's suggestion is more appropriate.

-adam

paz.periasamy@axa.com.au wrote:
> You can implement your own Plugin (method and context name) to compare
> the 
> strings...
>
> Thanks and regards,
> Pazhanikanthan. P (Paz)
>
> Consultant for AXA,
> HCL Australia Services Pty. Ltd.
> Off   : +61-3-9618-4085
> Mob : +61-0411-354-838
>
>
>
>
> "Raghuveer" <ra...@infotechsw.com>
> 14/07/2006 05:18 PM
> Please respond to "Struts Users Mailing List"
>
>  
>         To:     <us...@struts.apache.org>
>         cc: 
>         Subject:        Compare two strings in Validator frame work
>
>
>
> How to Compare two strings in validator framework?
> What i need to do in validation.xml.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> _____________________________________________________________________ 
> This e-mail has been scanned for viruses by MCI's Internet Managed 
> Scanning Services - powered by MessageLabs. For further information 
> visit http://www.mci.com
>
>
>
>
> ************************************************************************
> *********
> Important Note
> This email (including any attachments) contains information which is 
> confidential and may be subject to legal privilege.  If you are not 
> the intended recipient you must not use, distribute or copy this 
> email.  If you have received this email in error please notify the 
> sender immediately and delete this email. Any views expressed in this 
> email are not necessarily the views of AXA.   Thank you.
> ************************************************************************
> **********
>
>   

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