Detecting the Grails Environment in a GSP
Join the DZone community and get the full member experience.
Join For Free**** UPDATE ****
Thanks Burt for the comment pointing out that the original code I posted is actually deprecated and for pointing out a better way for testing environment.
According to the docs (and Burt), this is the correct way to test for environment in a GSP.
<g:if env="production">
<!-- Markup to include ONLY when in production -->
</g:if>
**** The code below is deprecated ****
<g:if test="${ grails.util.GrailsUtil.getEnvironment().equals(org.codehaus.groovy.grails.commons.GrailsApplication.ENV_PRODUCTION) }">
<!-- Markup to include ONLY when in production -->
</g:if>
Hope this helps others who are looking to do the same within their GSPs.
Published at DZone with permission of Steve Good, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
Getting Started With the YugabyteDB Managed REST API
-
Top 10 Pillars of Zero Trust Networks
-
Mastering Time Series Analysis: Techniques, Models, and Strategies
-
Merge GraphQL Schemas Using Apollo Server and Koa
Comments