Reputation: 3
Trying to evaluate the following but not seem to work
<s:set name="infoType" value='%{"info.aero.aeroType"}' />
<s:if test='%{#infoType == "A"}'>
<span> got it </span>
</s:if>
the return type for aeroType
is String that is set in a Java class and it returns a alphabet "A" or "B". If infoType is A, I need to perform some calculation. How to get this working?
Upvotes: 0
Views: 172
Reputation: 50203
Use var instead of name, because it is deprecated
General info on validating one character Strings (you are already flipping quotes, then this part is right)
This is your real problem: you are putting double quotes around your <s:set
value; this way you are telling OGNL to take that literal String, instead of reading an object from the stack;
then change this
<s:set name="infoType" value='%{"info.aero.aeroType"}' />
to this
<s:set var="infoType" value="%{info.aero.aeroType}" />
and it wil work
Upvotes: 1