-
jstl tag <if>
Hi,
I have a question on jstl <if> tag. I know that you use this in jsp to display something if a certain condition is true. I have a situation where I need to display an additional radio button if a certain condition is true. For some reason, this code is not working. To make it clear, I have posted the current codesnippet. I am displaying A,B,C radio buttons and in addition the "D" radio button if a certain condition is true only. My question is, is this right or should I use a choose <when> condition and display A,B,C radio buttons if a certain condition and display A,B,C and D if another condition. I appreciate you help. Thank you in advance. :
<tr>
<td class="CONTENT"><html-el:radio styleid="credit" property="creditCardKind" value="${Constants.CREDIT}" onclick="toggleCC(this.value)" />
<b><label for="credit">A</label></b></td>
<td class="CONTENT"><html-el:radio styleid="debit" property="creditCardKind" value="${Constants.DEBIT}" onclick="toggleCC(this.value)" />
<b><label for="debit">B</label></b></td>
<td class="CONTENT"><html-el:radio styleid="cash" property="creditCardKind" value="${Constants.CASH}" onclick="toggleCC(this.value)" />
<b><label for="cash">C</label></b></td>
<c:if test="${orderForm.isPIA}">
<td class="CONTENT"><html-el:radio styleid="paymentHold" property="creditCardKind" value="${Constants.CASH}" onclick="toggleCC(this.value)" />
<b><label for="cash">D</label></b> </td> </c:if> </tr>
-
Code:
<c:if test="${! empty orderForm.isPIA}">
<td class="CONTENT"><html-el:radio styleid="paymentHold" property="creditCardKind" value="${Constants.CASH}" onclick="toggleCC(this.value)" />
<b><label for="cash">D</label></b> </td> </c:if> </tr>
or you can use <c:choose > tag