mardi 23 juin 2015

Struts if condition not passing

<s:property value="pay.Fre"/> this is giving me 1, 4, or 12. I have to just check if condition for 1, 4 or 12 in jsp using struts 2 tag.

I am doing something link below but its not going in any if condition even if <s:property value="pay.Fre"/> is coming as 1. checked for 4 and 12 as well.

Please advice.

<td class="con" valign="top" width="35%"><s:text name="Add.Fre" /></td>
<td class="bodyContents" width="70%">
    check :<s:property value="pay.Fre"/>:
    <s:set var="One" value="%{'1'}" />
    <s:set var="Four" value="%{'4'}" />
    <s:set var="Twelve" value="%{'12'}" />
    <s:if test="%{(pay.Fre).equals(#One)}">
        <s:text name="AOption1"/>  
    </s:if> 
    <s:elseif test="%{(pay.Fre).equals(#Four)}">
        <s:text name="AOption2"/>
    </s:elseif>
    <s:elseif test="%{(pay.Fre).equals(#Twelve)}">
        <s:text name="AOption3"/>
    </s:elseif>

Aucun commentaire:

Enregistrer un commentaire