Accessing HTTP request parameters in grails gsp

I am developing a web application in grails in which, when I click on a link to an email user, it redirects to my grails web page. My requirement is to get access to the parameters of the http request, which I passed through the link in the email on my gsp page.

Example: - I passed the link http://example.com/testpage?a=something&b=12345 , and when the user clicks on this link, he redirects to http://example.com/testpage , and then I can get the parameter values from the request.
Like a=something and b=12345 . Thanks in advance.

+7
grails request
source share
3 answers

For URL:

http://example.com/testpage?a=something&b=12345

put it in your gsp

 <body> <p>Say ${params.a}</p> <p>count to 5, please: ${params.b}</p> </body> 

and you will see it on your page:

Say something

count to 5, please: 12345

+14
source

In every Grails controller, you have a params object. Thus, you must provide a valid URL that redirects the user to one of your controllers and triggers one of your actions, i.e.

 http://localhost:8080/MyApplication/myController/confirm?a=funnyParamA&b=funnyParamB class MyController { def confirm = { def a = params.a def b = params.b ... } } 
+5
source

Basically, when creating this URL with the ability to access http://example.com/testpage , you should create it something like

 http://example.com/testpage?a=${params.a}&b=${params.b} 
0
source

All Articles