views:

97

answers:

1

Hi

I have the following gsp page:

<g:def var="incidentMngmntId" value="${incidentMngmntInstance?.id}"/>
<g:link controller="ticketMngmnt" 
        action="list" params="[incidentMngmntId : incidentMngmntId]"
        id="${incidentMngmntInstance?.id}"> Tickets
</g:link>

The generated URL is as follows

http://localhost:8080/smtool/ticketMngmnt/list/94

Which is fact is not what is intended. (My intention is to generate a pair var=value as get or post.)

At the ticketMngmnt controller I have the following code which cannot catch the value of the parameter.

 def list = {       
    def incidentMngmntId = params.incidentMngmntId
    println "params.incidentMngmntId " + incidentMngmntId

    ...
}

and of course it is always printing

params.incidentMngmntId null

The question is twofold: First, is possible at the gsp level to generate a link of the form http://localhost:8080/smtool/ticketMngmnt/list?incidentMngmntId=94 (or a to give the par var=value as post)

Second, if not -the link remains as http://localhost:8080/smtool/ticketMngmnt/list/94 - then the question is how to read the value 94 at the controller.

Thanks a lot in advance.

Luis

PS: BTW, the value 94 is correct

+1  A: 

The posted code is correct as it is. I just restarted the server and that was.

The only think to be changed is the unnecessary id at the link

<g:def var="incidentMngmntId" value="${incidentMngmntInstance?.id}"/>
<g:link controller="ticketMngmnt" 
    action="list" params="[incidentMngmntId : incidentMngmntId]">
    Tickets
</g:link>

Sorry.

Luixv