Hide id param in url in Grails App

我的未来我决定 提交于 2019-12-13 03:59:10

问题


I have a URL that looks like /myController/myAction/id.

How could I hide the id in that URL so it looks like: /myController/myAction/username [email]


回答1:


Define in UrlMapping.groovy as "/myController/myAction/$username"(controller: "myController",action: "myAction") and you'll be able to get the param in controller params.username




回答2:


Define in UrlMapping.groovy as "/myController/myAction/$username"(controller: "myController",action: "myAction")

you'll be able to get the param in controller params.username



来源:https://stackoverflow.com/questions/16838160/hide-id-param-in-url-in-grails-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!