简体   繁体   中英

grails AbstractController's public method don't register to sub controller

I had an AbstractController in src/groovy/ssh

public void listAjax(){
   //do sth
}

then create-controller system.User

class UserController extends AbstractController{
}

but when I visit /user/listAjax, got 404 error.

parent's public method can't be auto register to sub controller?

Are you using Grails 2.0.0M1? Because in Grails 1.3.7 or lower, you can not use methods as controller actions.

If you are using Grails 1.3.7, try this instead for your AbstractController:

public class AbstractController {
    def listAjax = {
       //do sth
    }
}

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