mongodb - Grails URL id field not getting mapped to params -
here urlmappings.groovy
class urlmappings { static mappings = { "/$controller/$action?/$id?(.${format})?" { constraints { // apply constraints here } } "/ewhet/$id"(controller : "ewhet", action : "show") "/"(view: "/index") "500"(view: '/error') } }
here ewhetcontroller
's show
action:
class ewhetcontroller { def index(){ } def show(){ def ctx = startasync() ctx.start { render params //render "this invoked!!" ctx.complete() } } }
now when enter url as: http://localhost:8080/g24/ewhet/abc
abc
not mapped params.id
, when render params
, empty map [:]
. in case if url entered http://localhost:8080/g24/ewhet/show?id=abc
id
field gets mapped params.id
, get:
['id':'abc']
so want last part of url mapped id
parameter in params
map without using map in url (like id=abc
) per section 7.4.3 in grails documentation how possible , why approach not working?
kindly note not have domain classes using schemaless mongodb @ backend.
try reload app after changing urlmappings.groovy assure new config correctly loaded.
Comments
Post a Comment