Results 1 to 2 of 2

Thread: jstl tag <if>

  1. #1
    subha is offline Member
    Join Date
    Apr 2009
    Posts
    1
    Rep Power
    0

    Default 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>

  2. #2
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    6

    Default

    Java 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

Similar Threads

  1. JSTL problem
    By mihir66 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 03-05-2009, 02:28 PM
  2. JSTL: Help in displaying a particular element
    By nn12 in forum Advanced Java
    Replies: 2
    Last Post: 12-08-2008, 07:57 AM
  3. jstl in jsp
    By nagaprasanna in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-18-2008, 08:18 AM
  4. JSTL Exception Handling
    By chaatf in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-18-2007, 02:24 AM
  5. JSTL error
    By Eric in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 06-11-2007, 09:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •