struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Lentz <>
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] -

From:   mohan rao <>
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 
are same. (I think it's checking reference.)

View this message in context:

Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

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