简体   繁体   中英

grails url mapping

i am new to grails & want to know:- how to get the default grails url mapping in grails? Where are they stored? how can the default url mappings replaced by our custom url mappings from the grails controller?

URLMapping is done in the urlmappings.groovy file. Read more on how to map on http://grails.org/doc/latest/guide/6.%20The%20Web%20Layer.html#6.4%20URL%20Mappings

Here is an example of UrlMappings

class UrlMappings {
    static mappings = {
        "/$controller/$action?/$id?"{
            constraints {
                // apply constraints here
            }
        }

        "/"(view:"/index")
        "500"(view:'/error')
    }
}

See the latest documentation: https://grails.github.io/grails-doc/latest/ref/Plug-ins/URL%20mappings.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM