Default value on JSP custom-tag attribute

There is a better way:

<c:set var="title" value="${(empty title) ? 'Default title' : title}" />

No need for custom tag in Java nor tld. Just plain JSP EL and conditional operator.


In my opinion it is shorter and cleaner than old:

<c:if test="${empty title}" >
 <c:set var="title" value="Default title" />
</c:if>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)