Problem with <s:if> and string
Hi
I have code
Code:
<s:form action="SwitchActive" method="POST">
<s:hidden name="isActive" value="%{isActive}" />
<s:if test="%{#isActive=='Y'}">
<s:submit value="ACTIVE" name="switchActiveButton" />
</s:if>
<s:else>
<s:submit value="INACTIVE" name="switchActiveButton" />
</s:else>
</s:form>
isActive is equal to 'Y' (checked in generated page), but button has value "INACTIVE". How should I compare variable with string? Google says that my way is correct, but it still doesn't work...
Re: Problem with <s:if> and string
ok, found workaround (or just working way?)
Code:
<s:set name="isActiveVar" value="%{isActive}" />
<s:form action="SwitchActive" method="POST">
<s:hidden name="isActive" value="%{isActive}" />
<s:if test="%{#isActiveVar==\"Y\"}">
<s:submit value="ACTIVE" name="switchActiveButton" />
</s:if>
<s:else>
<s:submit value="INACTIVE" name="switchActiveButton" />
</s:else>
</s:form>