Search code examples
grailsurl-mapping

Grails url mapping layout not loaded


I edited UrlMappings.groovy to map my root "/" directory to a special view.

What I did was

"/"(controller: 'myController', action: 'index')

The problem is that the layout in this index view isn't loaded. Any hints?

Thanks in advance.


Solution

  • "/"(controller:'main', action:'index')
    

    and

    def index(){}
    

    with layout in

    ../grails-app/views/layouts/main.gsp
    

    works for me.

    [edited]

    Move your image under here, like

    ../grails-app/assets/images/my-image.png
    

    then, use

    <g:img dir="images" file="my-image.png"/>
    

    in your page.