Pergunta

With Grails, is it possible to get the name of the view that is being rendered while in the layout GSP file? I'd like to change one minor thing in the layout file depending on which view is going to be rendered.

Foi útil?

Solução

If found this to be rather difficult to determine. It's easy if you use conventions, but you can always explicitly render any view you want. See the code in How to detect which view file has been rendered in grails for how to determine this in a filter.

Outras dicas

The name of the view is normally the same as the action that has just been executed (e.g. show action normally renders the show.gsp view) - if this is the case in your view, then you can get it in your layout gsp using ${actionName}.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top