0

The value of y is null, but it always execute otherwise part. part. null is considered as not empty.

<c:choose>
  <c:when test="${empty y}">
   value=""
  </c:when>
<c:otherwise>
 value="${y}"
</c:otherwise>      

1 Answers1

0

If y is string write your code like this

    <c:choose>
        <c:when test="${y==null || y==''}">
          value=""
        </c:when>
        <c:otherwise>
         value="${y}"
        </c:otherwise> 
    </c:choose>
Avijit Barua
  • 2,950
  • 5
  • 14
  • 35
  • 1
    That's exactly the same as `empty` will be doing for you. See https://stackoverflow.com/questions/14185031/how-does-el-empty-operator-work-in-jsf – Jasper de Vries Dec 06 '18 at 14:39