I have a custom taglib. I am going to pass the result of the taglib into the g:render taglib. One of the parameters is an Asset object. If I call the taglib by itself it works fine. The parameter is in fact an Asset Object.
Example:
templateFinder template="_displayMain" findByFactory="asset" findByObject="${params.asset}"
The correctly renders the params.asset as an Asset in the templateFinder taglib.
However once I add it to the g:render taglib it turns into the toString representation of the Asset object.
Example:
render template="${g.templateFinder(template:'_displayMain', findByFactory:'asset', findByObject:"${params.asset}")}" ..../>
This results in a Class Cast errorwith class 'org.codehaus.groovy.runtime.GStringImpl' to my Asset class.
I am confused as to why this is rendering as an Object in the first example but a Gstring in the second.
Thanks for any help.
You are converting the asset to a string by enclosing it in "${...}"
. Try this:
<g:render template="${g.templateFinder(template:'_displayMain',
findByFactory:'asset', findByObject: params.asset)}" ..../>