Grails - GSP Tag - if

Tag - if

Description

The logical if tag to switch on an expression and/or current environment.

Parameters

  • test - The expression to test
  • env - (Since 1.0) An environment name
At least one of the parameters must be supplied. If both are supplied, they are combined using AND.

Examples

<g:if test="${name == 'fred'}">
     Hello ${name}!
</g:if>
<g:if env="development">
     Dev mode - debug: $someDebug
</g:if>
<g:if env="production" test="${cacheEnabled}">
     $cache.getContent('1234')
</g:if>