如何使用模板中子切割定义的控制器路线 [英] How to use controller route defined by subcut in the template
本文介绍了如何使用模板中子切割定义的控制器路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的路由文件中有一个定义为@ com.xyx.abc(str:String)的路由.
I have a route defined as @com.xyx.abc(str: String) in my routes file.
我想在模板中使用此路由.我尝试使用
I want to use this route in a template. I tried using
<a href="@com.xyx.abc("temp")/>
显然没有用.
谢谢.
推荐答案
每个程序包都会生成一个反向路由器.因此,如果您有一个名为com
的程序包,一个名为xyx
的控制器和一个名为abc
的方法,那么您可以这样做:
Reverse routers are generated per package. So, if you have a package called com
, a controller called xyx
and a method called abc
, then you can do this:
@com.routes.xyx.abc("temp")
或者,如果它是更现实的@com.example.MyController.abc(str: String)
,那么它将是:
Or if it's a more realistic @com.example.MyController.abc(str: String)
, then it would be:
@com.example.routes.MyController.abc("temp")
这篇关于如何使用模板中子切割定义的控制器路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文