In the following code the label is always contract.alerts.column.emailtext.clearcneRequested even if condition is true. please let me know if Im missing anything in the code Also I need to print the value that comes in key. how can I do that ?
<div id="alertPopUpDiv" style="display: none;" >
<table id="tableListingAlerts" width="1150px">
<thead>
<s:if test="%{key == ' Conflicts Cleared'}">
<tr><th align='center' colspan='9'><b><label for="name-prefix"><s:property value="%{getLabel('contract.alerts.column.emailtext.conflictsCleared')}" /></label></b></th></tr>
</s:if>
<s:else>
<tr><th align='center' colspan='9'><b><label for="name-prefix"><s:property value="%{getLabel('contract.alerts.column.emailtext.clearcneRequested')}" /></label></b></th></tr>
</s:else>
</thead>
<tbody id="mainAlertTBody" >
</tbody>
</table>
</div>
I have also tried using
<c:choose>
<c:when test="${key == 'Conflicts Cleared'}">
<tr><th align='center' colspan='9'><b><label for="name-prefix"><s:property value="%{getLabel('contract.alerts.column.emailtext.conflictsCleared')}" /></label></b></th></tr>
</c:when>
<c:otherwise>
<tr><th align='center' colspan='9'><b><label for="name-prefix"><s:property value="%{getLabel('contract.alerts.column.emailtext.clearcneRequested')}" /></label></b></th></tr>
</c:otherwise>
</c:choose>
still only contract.alerts.column.emailtext.lrccclearcneRequested gets printed
Your key
may be null. Print the key before you enter the <c:choose>
tag . your syntax seems to be correct.
<c:choose>
<c:when test="${key == 'Conflicts Cleared'}">
<tr><th align='center' colspan='9'><b><label for="name-prefix"><s:property value="%{getLabel('contract.alerts.column.emailtext.conflictsCleared')}" /></label></b></th></tr>
</c:when>
<c:otherwise>
<tr><th align='center' colspan='9'><b><label for="name-prefix"><s:property value="%{getLabel('contract.alerts.column.emailtext.clearcneRequested')}" /></label></b></th></tr>
</c:otherwise>
</c:choose>