Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails: Returning parameters from a taglib

Tags:

grails

taglib

How do I return values from a taglib that has been called in a controller action such that it automatically retains the full type structure of the values setup in the taglib?

I can use the out << approach but this returns strings or array of strings.

I have tried to use a [] mapping as used transfer a set of values at the end of an action to its view.

I have also tried a return statement again unsuccessfully - besides I need to return more than one set of values.

-mike

like image 730
mikek Avatar asked Jun 05 '14 14:06

mikek


1 Answers

from the top of the documentation http://grails.org/doc/latest/guide/theWebLayer.html#tagReturnValue

class ObjectReturningTagLib {

  static returnObjectForTags = ['content']

  def content = { attrs, body ->
    someValue()
  }
}
like image 138
injecteer Avatar answered Nov 23 '22 20:11

injecteer