简体   繁体   中英

Grails - Custom tag inside a standard Grails tag

It is possible to call a Grails' tag inside another one using the following synthax.

<g:aContainingGrailsTag value="${aContainedGrailsTag(attr:'whatever')}"

Is it possible to include a custom tag into a Grails tag using the exact same syntax. I am trying it this way:

<td class="${redOrGreen(number:'i')}"> </td>

but it does not work. Any insight on this greatly appreciated.

In this specific case, you can do it like this:

<td class="<yourNameSpace:redOrGreen number='i' />"> </td>

or in general:

<td class="${yourNameSpace.redOrGreen(number:'i')}"> </td>

Only for tags within g: can be called without namespace prefix.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM