如何在Grails中调试MissingPropertyExceptionMessage错误?

时间:2016-03-17 05:44:09

标签: grails

User.grrovy

package com

class User {
    String name

    static constraints = {
        name blank:false

    }
}    

Usercontroller.groovy

package com

class UserController {

    def index() {
        redirect(action:sup)
    }
    def sup(){
        def person=[name:'sai']
        def user=new User(person)
        assert s.name=='sai'

    }
}

当我运行此任务时,它会显示:

  

错误500:内部服务器错误

     

URI:/ practice / user / indexClass:groovy.lang.MissingPropertyExceptionMessage:没有这样的属性:sup for class:com.moog.UserController

1 个答案:

答案 0 :(得分:1)

你应该:

redirect(action:'sup')