Reputation: 123
I'm trying to get parameters from the url using param in a controller. My url is: .../index?format=json
I've tried to get the params from the following two methods:
def format = params.format
def parameters = getParams()
The below is what I get in the debug results:
My question is why the format value isn't coming through in the code?
Upvotes: 0
Views: 619
Reputation: 653
The format parameter gets populated by the type of content you are asking for (JSON, XML, etc). So, a request parameter called format will get overridden.
See here for more details: Grails 2.3.x: get the value of URL parameters
Upvotes: 2