Sayem
Sayem

Reputation: 713

How to get Get parameter from url in grails

I have a project where I am creating links like this:

http://abcdefc.com/Nfploginsystem/registration/resetpass?key=1234

The action for that link gets set like <g:form action="chkresetpass" method="GET"> I want to pass the name of the controller as a key="value" pair like: action="chkresetpass" So, the controller can respond with code like this:

def chkresetpass(){  
       flash.message= params.key 
       redirect(action:"resetpass");
       }

but i'm not able to get that parameter from the url -! Can anyone help me with this, please?

Upvotes: 3

Views: 11097

Answers (2)

Vitor Hugo
Vitor Hugo

Reputation: 1126

Change the:

http://abcdefc.com/Nfploginsystem/registration/resetpass?key=1234

to:

http://abcdefc.com/Nfploginsystem/registration/chkresetpass?key=1234

and now on the chkresetpass action you will have params.key

Upvotes: 3

tim_yates
tim_yates

Reputation: 171084

The documentation shows you how to use params

http://grails.org/doc/latest/ref/Controllers/params.html

So params.key

Upvotes: 1

Related Questions