Grails:如何在过滤器中使用createLink? [英] Grails: how to use createLink in a Filter?

查看:171
本文介绍了Grails:如何在过滤器中使用createLink?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简短的问题:

如何使用 createLink



出现错误:
$ b


没有方法的签名:
MyFilters.createLink()适用于参数类型
...

我的代码是

$ p $ createLink(controller:'home')



这段代码在Controller中工作,但不在Filter中。

解决方案

已解决!

  import org.codehaus.groovy.grails.plugins。 web.taglib.ApplicationTagLib 
$ b $ new ApplicationTagLib()。createLink([controller:'home'])


Short question:

How can I use createLink in a Filter?

I'm getting error:

No signature of method: MyFilters.createLink() is applicable for argument types...

My code is

createLink(controller:'home')

This code works inside a Controller, but not in a Filter.

解决方案

SOLVED!

import org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib
...
new ApplicationTagLib().createLink([controller: 'home'])

这篇关于Grails:如何在过滤器中使用createLink?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆