Here is a controller code that will pass a number to a GSP:
class TestController { def index() { [num:-50] } }Here is a GSP code that uses both if, elseif, and else tags:
<g:if test="${num==0}"> The number ${num} is zero. </g:if> <g:elseif test="${num<0}"> The number ${num} is negative. </g:elseif> <g:else> The number ${num} is positive. </g:else>
Notice that there are 2 test condition and 3 possible outcome.
The expected output is:
The number -50 is negative.