Tuesday, July 20, 2004

Checking for null or empty string values

Flow control can be accomplished using the <c:if>
Its test attribute can contain an EL expression.
To test if a value is null you can compare the attribute to null like:
    <c:if test="${valueToTest eq null}">
If the value exists but is empty you can test it using:
    <c:if test="${empty valueToTest}">
I assumed that the empty operator was a binairy operator but after thourough testing it appeared to be a unairy operator.