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