I am trying to conditionally set this variable so I don't have to display date slashes when I display an empty entry.
<c:choose>
<c:when test="${fn:length(findYear[1]) eq 0}">...</c:when>
<c:set var="dateformat" value="fn:length(findYear[1]) " />
<c:when test="${fn:length(findYear[1]) gt 0}">
<c:set var="dateformat" value="${findYear[1]} / ${findYear[2]} / ${findYear[0]}" />
</c:when>
</c:choose>
<tr:column width="71px" align="center" headerText="Date" sortable="true" sortProperty="type">
<tr:outputText value= "${dateformat}">
<!-- "${findYear[1]} / ${findYear[2]} / ${findYear[0]}" readOnly= "true" > -->
</tr:outputText>
Right now, nothing is showing up when I call the variable. Any help would be appreciated.
Try something like this:
emptyoperator returnstruewhen the argument isnullor empty string.<set>statement was outside of any<when>block, and its value did not contain${}...<otherwise>could be used.