How to make my URL mapping case insensitive?

前端 未结 4 1195
慢半拍i
慢半拍i 2021-01-05 14:39

Grails, by default, is case-sensitive when mapping URL to controller actions or views.

For instance, www.mywebsite.com/book/list will work BUT www.mywebsite.com/Boo

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-05 15:16

    Just a shoot from the hip, try the following:

    static mappings = {
    "/$controller/$action?/$id?"{
        controller = controller.toLowerCase()
        action = action.toLowerCase()
    }
    

提交回复
热议问题