Can I use grails tag outside of GSP?

前端 未结 4 857
忘了有多久
忘了有多久 2020-12-09 10:24

For example, i can put

  

inside a .gsp file and it will work nicely.

Bu

4条回答
  •  [愿得一人]
    2020-12-09 11:16

    Inject the grailsApplication into your service/filter.

    def grailsApplication
    

    And get the Spring bean.

    def g = grailsApplication.mainContext.getBean('org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib')
    def userShow = g.createLink(controller: 'user', action: 'show')
    

提交回复
热议问题