1 Reply Latest reply on Jul 13, 2010 5:37 AM by Akaine Harga

    if condition always fails

    Satya K Newbie

      Hello,

       

      Can you tell me why the c:if always fails and enters c:otherwise clause ?

       

      Is there anything wrong in finding out the length of the string?

       

      Regards,
      Satya

        • 1. Re: if condition always fails
          Akaine Harga Novice

          Khm... in JSTL if checks for a condition and executes/renders the contents if its true, there is no otherwise statement for it.

          The if-else like structure in JSTL is achieved by using choose statement:

           

          <c:choose>
               <c:when test="${user.role == 'member'}">
                    <p>Welcome, member!</p>
               </c:when>
               <c:otherwise>
                    <p>Welcome, guest!</p>
               </c:otherwise>
          </c:choose>