Search code examples
grailsgsp

Render taglib from markup grails


Inside my controller I have an action with this return:

 render {
        li {
            input(name:'question'+questNumber)
            remoteLink(action: 'addResponseToQuest',onsuccess:'logTestData(data)',"Link")
        }
    }

The list element is correctly rendered, but the remotelink no.

How can I use render the same result as tag?

With encodeAsHTML() nothing happens.

Thanks in advance

Luis


Solution

  • Prefix your tags with mkp.yieldUnescaped, e.g.:

    render {
        li {
            input(name:'question'+questNumber)
            mkp.yieldUnescaped remoteLink(action: 'addResponseToQuest',onsuccess:'logTestData(data)',"Link")
        }
    }
    

    The render closure is an instance of a Groovy MarkupBuilder, see its docs for explanation.