struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Lentz <Eric.Le...@sherwin.com>
Subject Re: How to compare string reference variables using ognl?
Date Mon, 12 Dec 2011 15:49:41 GMT
When you use a value from the set tag you'll need to prefix with the '#' 
as per the documentation [1]

I've definitely used equals in the past and know it works (although not in 
the property tag like you are, but should be the same as in s:if; OGNL 
either way)

Something like this might work:
<s:property value="#selectedOffer.equals(#queryString)"/>

But why use set at all? Just use the source variables:
<s:property value="ecOffers.dicountKey.equals(#entry.key)"/>

I don't believe this will work for the reason you site. equals is the way 
to go.
<s:property value='#selectedOffer==#queryString'/>

[1] - http://struts.apache.org/2.2.1/docs/set.html



From:   mohan rao <mohanaraosv@gmail.com>
To:     user@struts.apache.org
Date:   12/12/2011 09:24 AM
Subject:        Re: How to compare string reference variables using ognl?



<s:set var="selectedOffer" value="%{ecOffers.dicountKey}"/>
<s:iterator var ="entry" value = "#session.discountOffers">
<s:set var="queryString" value="%{#entry.key}"/>
<s:property value="selectedOffer.equals(queryString)"/>  It supposed to
print true or false. But not printing any value

<s:property value='#selectedOffer==#queryString'/> Printing false even 
they
are same. (I think it's checking reference.)

--
View this message in context: 
http://struts.1045723.n5.nabble.com/How-to-compare-string-reference-variables-using-ognl-tp5060783p5067525.html

Sent from the Struts - User mailing list archive at Nabble.com.

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



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message