4

I'm trying to do this:

"/templates/$tml"{
        view: "/templates/$tml"
    }

and this:

"/templates/$tml"{
        view: "/templates/${tml}"
    }

and this:

"/templates/$tml"{
        view: "/templates/${params.tml}"
    }

But none of them work. In the template folder I have a a lot of GSP files and I don't want to map them one by one, instead I want some generic code which map them like the controller mapping.

Thanks for help!

Noampz
  • 1,185
  • 3
  • 11
  • 19

2 Answers2

6

Did you try something like this?

In the UrlMappings.groovy:

"/templates/$tml"(controller: "templates", action: "generateView")

In the TemplatesController.groovy:

def generateView(String tml){
    render(view: tml)
}
user711189
  • 4,383
  • 4
  • 30
  • 48
  • Yes, it works! Thanks!!! is there no chance to do this without a controller? I just want to be sure I accept the best solution... – Noampz Dec 01 '13 at 13:04
0

I am not sure but you can try something like this

"/templates/$tml"(view: "/templates/$tml")

Normal procedure is

"/templates/$tml"{
    controller = "general"
    action = "generalAction"
    //pageName = "yourpage"
 }
  • I tried this code as well (I forgot to write this in the all examples in the question), this one was my first attempt to do that and it looks the most intuitive way to do that, but it doesn't work – Noampz Dec 01 '13 at 13:09