简体   繁体   中英

how to redirect to a gsp page( grails)?

I have somme trouble in my app. there are two domain classes : 1st named patient 2nd named antecedants

When i show a patient ,instance of antecedants is displayed. when i click it it goes to the antecedants view/show . the delete button below is clickable

 <g:if test="${patientInstance.antecedant == null}">
            <li ><g:link  class="create" params="[id: patientInstance.id]" controller="Antecedants" action="create" id="${this.id }">Saisir les antecedants</g:link>  </li>
            </g:if>

so when i do, i sent a parameter within ag:link to the antecedants controller named num (for test) , all of this to get back to the patient it all began with:

redirect (uri: "/patient/show/${y}")

And that's where the issue comes , when i run it and go to the view/antecedant/1 and i click on delete ,it takes me to an 405 error page .description :The specified HTTP method is not allowed for the requested resource.

    def y=params.num
    antecedantsInstance.delete flush:true

thank you in advance.

Do you send propably a delete http method or is your action declared by a allowed method that is not the same that you sent?? If you do this, you have to add a method declaration to your action in the controller. See http://grails.org/doc/latest/ref/Controllers/allowedMethods.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM