Search code examples
grailsgrails-2.0grails-controller

Load Controller from View in Grails


As an example I use an controller called "Akun"

package myipaymu

class AkunController {    
    def index() {}
    def profil() {}
}

In my view I want to load "profil" action just like iframe in html, but not iframe.

---------------------------------------
|          index                      |
|                                     |
|     ---------------------------     |
|     | profil                  |     |
|     |                         |     |
|     --------------------------      |
---------------------------------------

I think I can use <g: but I don't really understand how it works. can any one help me? Or suggest where I can find the tutorial??


Solution

  • If I understand correctly, you want to include the response from the profil controller action within a GSP? The easiest way to do this is with the g:include tag, e.g.

    ---------------------------------------
    |          index                      |
    |                                     |
    | ---------------------------------   |
    | | <g:include action="profil"/>  |   |
    | |                               |   |
    | ---------------------------------   |
    ---------------------------------------