Grails - GSP Tag - set

Tag - set

Description

Set the value of a variable accessible with the GSP page.

Parameters

  • var - The name of the variable
  • value - The initial value to be assgined

Examples


<g:set var="tomorrow" value="${new Date(today.getTime() + 24L * 60 * 60 * 1000)}" />

<g:set var="counter" value="${1}" />
<g:each in="${list}">
    ${counter}.&nbsp; ${it} -> ${counter % 2 == 0 ? 'even' : 'odd'}
    <g:set var="counter" value="${counter + 1}" /><br>
</g:each>