<g:formatBoolean boolean="${myBoolean}" /> <g:formatBoolean boolean="${myBoolean}" true="True!" false="False!" />
boolean
true
false
Show Source
def formatBoolean = { attrs -> if (!attrs.containsKey("boolean")) throwTagError("Tag [formatBoolean] is missing required attribute [boolean]") def b = attrs.get("boolean") if (b == null) { return } else if (!(b instanceof Boolean)) { b = Boolean.valueOf(b) } if (b) { out << (attrs["true"] ?: message(code:"boolean.true", default: message(code:"default.boolean.true", default:"True"))) } else { out << (attrs["false"] ?: message(code:"boolean.false", default: message(code:"default.boolean.false", default:"False"))) } }