In grails gsp, instead of
<g:if env="development">
<h1> xyz </h1>
</g:if>
<g:if env="production">
<h1> xyz </h1>
</g:if>
is it possible to write logical or condition in <g:if> to combine the two conditions
for example
<g:if test="env='production'"||"env='devlopment'">
<h1> xyz </h1>
</g:if>
What's the right way of doing that?
Just for the sake of DRYness:
<%@ page import="grails.util.Environment" %>
<g:if test="${Environment.current in
[Environment.PRODUCTION, Environment.DEVELOPMENT]}">
<h1>xyz</h1>
</g:if>
I found the following would work.
<g:if test="${grails.util.Environment.current.name.equals('development') ||
grails.util.Environment.current.name.equals('production')}">
<h1>xyz</h1>
</g:if>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With