grails - Fire a method when the URL is clicked - beginner -
grails - Fire a method when the URL is clicked - beginner -
i sending user next url
example: http://ipaddress.com/myapp/user/verify?val=676687jhjhjdfhjdhfjdfhemail=email@gmail.com
when user clicks on this, need method phone call verify() in usercontroller fired , should assigned variable called val , email.
i cross check database , check if val equal email
how can this. know how send url user not sure how write method fired after url clicked.
def verify (string val, string email) { }
few things note:
-- when sending url user create sure url valid, i.e., should like: http://example.com/user/verify?... , not like: /user/verify?.... send url like
<g:link controller="user" action="verify" params="[val:'val', email: 'email']" absolute="true">click here</g:link> or
<g:link controller="user" action="verify" params="[val:'val', email: 'email']" base="${grailsapplication.config.grails.serverurl}">click here</g:link> -- if using spring security , controller secured , want user nail action without login create available users using is_authenticated_anonymously like
@secured('is_authenticated_anonymously') def verify (string val, string email) { ... } -- action fine. should under usercontroller
-- url pasted in question missing &. val , email in action, url should like:
http://ipaddress.com/myapp/user/verify?val=676687jhjhjdfhjdhfjdfh&email=email@gmail.com grails groovy
Comments
Post a Comment