简体   繁体   中英

Grails Local Plugin Render

I'm trying to access methods from controllers in a local plugin. I included the plugin like so:

grails.plugin.location.'helloworld' = "../helloworld"

I want to invoke the hello() method and pass in some params to it. I tried the following from the index page of my app:

<g:include plugin="helloworld" action="index" controller="hello" model="['name':'John Doe']"></g:include>

Here is the controller method in the plugin:

package helloworld

class HelloController {

    def index() {
        println "working"
    }
}

I'm trying to keep it simple and get it to work before I worry about rendering views and processing parameters. I'm sure my approach is not the right way, I just need someone to point me in the right direction please.

Try:

package helloworld

class HelloController {

    def index() {
        render "working"
    }
}

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