我正在尝试这样做:
"/templates/$tml"{ view: "/templates/$tml" }
还有这个:
"/templates/$tml"{ view: "/templates/${tml}" }
还有这个:
"/templates/$tml"{ view: "/templates/${params.tml}" }
但它们都不起作用.在模板文件夹中,我有很多GSP文件,我不想逐个映射它们,而是我想要一些通用代码,它们像控制器映射一样映射它们.
感谢帮助!
你尝试过这样的事吗?
在UrlMappings.groovy
:
"/templates/$tml"(controller: "templates", action: "generateView")
在TemplatesController.groovy
:
def generateView(String tml){ render(view: tml) }