You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@yahoo.com> on 2001/07/03 18:34:44 UTC

NotEqual Tag to compare multiple properties to a value

Is it possible to use the notEqual tag to compare multiple properties to a single value?

I'd like to write code similar to the following

<logic:notEqual name="myForm" properties="property1,property2" value="">
    do something if either property not equal to ""
</logic:notEqual>

Thanks,

Matt

P.S.  I figured out my issue below - it was an iPlanet bug.  For value, I used value="<%=""%>" and it worked as expected.
  ----- Original Message ----- 
  From: Matt Raible 
  To: Struts User 
  Sent: Monday, July 02, 2001 12:17 PM
  Subject: NotEqual or Present?


  I am trying to check if the user entered a value for a search criteria in a results page.  My ActionForm sets a property to "" if the user did not enter a value.

  So in the following code, I want to only show it if the property does not equal "".  But the following does not work, should it?

  <logic:notEqual name="myForm" property="searchParam" value="">
      show this if property "searchParam" is not equal to ""
  </logic:notEqual>

  Thanks,

  Matt

RE: NotEqual Tag to compare multiple properties to a value

Posted by Niall Pemberton <ni...@btInternet.com>.
You cant do that with the struts NotEqualTag .... you can however with the
IF/THEN/ELSE tags I wrote which Ted Husted has posted on his site:

http://www.husted.com/about/struts/resources.htm#extensions


<logic:if     name="myForm" property="property1" op="NotEqual" value ="xxx">
<logic:and name="myForm" property="property2" op="NotEqual" value ="xxx"/>
<logic:and name="myForm" property="property3" op="NotEqual" value ="xxx"/>

  <logic:then>
      .............
  </logic:then>

  <logic:else>
      ............
  </logic:else>

</logic:if>


Niall

 -----Original Message-----
From: Matt Raible [mailto:matt_raible@yahoo.com]
Sent: 03 July 2001 17:35
To: Struts User
Subject: NotEqual Tag to compare multiple properties to a value


  Is it possible to use the notEqual tag to compare multiple properties to a
single value?

  I'd like to write code similar to the following

  <logic:notEqual name="myForm" properties="property1,property2" value="">
      do something if either property not equal to ""
  </logic:notEqual>

  Thanks,

  Matt

  P.S.  I figured out my issue below - it was an iPlanet bug.  For value, I
used value="<%=""%>" and it worked as expected.
    ----- Original Message -----
    From: Matt Raible
    To: Struts User
    Sent: Monday, July 02, 2001 12:17 PM
    Subject: NotEqual or Present?


    I am trying to check if the user entered a value for a search criteria
in a results page.  My ActionForm sets a property to "" if the user did not
enter a value.

    So in the following code, I want to only show it if the property does
not equal "".  But the following does not work, should it?

    <logic:notEqual name="myForm" property="searchParam" value="">
        show this if property "searchParam" is not equal to ""
    </logic:notEqual>

    Thanks,

    Matt