The j:if tag is used to conditionally evaluate its body based on some expression. Unlike other programming languages, there aren't any else-if or else options. It accepts the following attribute:
- test: This is used to specify the Jelly expression (condition) to evaluate. If the expression evaluates to true, the body of the tag is evaluated.
For example:
<g:evaluatevar="jvar_gr" object="true"> var gr = new GlideRecord("x_8940_travel_book_booking_request"); gr.addQuery("active", true); gr.query(); gr; </g:evaluate> <j:if test="${!jvar_gr.hasNext()}"> We did not find any active incidents. </j:if> <j:if test="${jvar_gr.next()}"> We found ${jvar_gr.getRowCount()} active incidents. </j:if>