I want to pass the id="${training.id}" to the Organization controller wiith the confirmed() function inside the controller.but when i am passing it,it is showing me the NULL result.The (id) i am printing is NULL.
gsp file
<g:each in="${trainingLists}" var="training">
<div class="card">
<div class="card-header">
<h3>Organization Name:</h3>${training.organization.orgName}</div>
<div class="card-body">
<h3>Organization Description:</h3>${training.organization.orgDesc}</div>
<div class="card-body">
<h3>Training Available:</h3>${training.name}</div>
<sec:ifNotLoggedIn>
<g:link controller="organization" action="notconfirmed">Apply</g:link>
</sec:ifNotLoggedIn>
<sec:ifLoggedIn>
<g:link action="confirmed" id="${training.id}">Apply</g:link>
</sec:ifLoggedIn>
</div>
<br>
</g:each>
Organization.controller
def confirmed(){
def id = params.id
println(id)
}
Your gsp <g:link>
looks good.
Please debug and check is ${training.id}
have valid id.
<g:link controller="organization" action="confirmed" id="${training.id}">Apply</g:link>
still getting issue then temporary hard-code id to and check for Example:
<g:link controller="organization" action="confirmed" id="2">Apply</g:link>
Now in address bar you will URL like localhost:8080/organization/confirmed/2
and controller println also print the 2.
You can check documentation for more attributes and options