Grails URLMapping

Given this URLMapping

"/news/show/$id?/item/$itemId?" {
 controller = "news"
 action = "show"
 }

results in the following params:

URL: http://localhost:8080/rfw/news/show
params: [“action”:”show”, “controller”:”news”]

URL: http://localhost:8080/rfw/news/show/1
params: [“id”:”1″, “action”:”show”, “controller”:”news”]

URL: http://localhost:8080/rfw/news/show/1/item
params: [“id”:”1″, “action”:”show”, “controller”:”news”]

URL: http://localhost:8080/rfw/news/show/1/item/4
params: [“id”:”1″, “action”:”show”, “controller”:”news”, “itemId”:”4″]

Leave a comment