Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails - entityName is null

Tags:

grails

Grials newbie - my boilerplate, generated view code is returning null when trying to resolve the entityName argument passed to the g:message tag. So...

<g:message code="default.show.label" args="[entityName]" />

renders as "Show null" instead of "Show [the domain class name]"

Any idea what may be going on here, or suggestions on how to diagnose this? I have been making incremental changes to both the views and the domain classes but wouldn't expect this to have made any difference

like image 931
raven Avatar asked Aug 06 '26 19:08

raven


1 Answers

entityName is a variable and set by the set tag lib, which must placed before the message tags using this variable. e.g.

// first define the entity name var
<g:set var="entityName" value="${message(code: 'test', default: 'TEST')}"/>
// display msg
<g:message code="default.show.label" args="[entityName]" />

maybe you forget to define this var or accidentally deleted this line of code.

like image 111
hitty5 Avatar answered Aug 09 '26 13:08

hitty5