Como mostrar sim/nao ao invés de true/false em uma list.gsp
14/11/2008 00:00
<g:if test="${bean.atributo}">
Sim
</g:if>
<g:else>
Não
</g:else>
<td>${bean.property ? 'Sim' :'Não'}</td>
class MyTagLib {
static namespace = 'my'
def simnao = { attrs ->
String valor = attrs['value']
String label = "Não";
if ("true".equals(valor))
label = "Sim"
out << label
}
}
<my:simnao value="${fieldValue(bean:objeto,field:'atributo')}"/>
class MyTagLib {
static namespace = 'my'
def simnao = { attrs ->
String valor = attrs['value']
String label = g.message(code:'no',default:'No')
if ("true".equals(valor))
label = g.message(code:'yes',default:'Yes')
out << label
}
}
Para se registrar, clique aqui.