0

Basically I am using the code below for debugging. It renders null and I cannot figure out the reason. And by the way the else statement will always be executed at this point. At first I didnt have the save method but I then thought it might fix my issue. May is have to do with the scope of my domains? As of now I have them set to session scope: class Info { static scope = "session" String name String smokingStatus String[] symptom static constraints = { } }


        else{//query did not find patient with that id
            def patInfo = new Info()
            patInfo.name = "Dennis"
            patInfo.smokingStatus = "Former Smoker"
            patInfo.symptom = ["Cough"]
            patInfo.save()
            redirect(action:"display", params: [patInfo:patInfo])
            //redirect(action:"login")
            //return to login action and 
        }
    }   
}

def display(){
    render params.name 
}

Thanks for any help its much appreciated.

4

1 回答 1

1

您将 patInfo 的值分配给变量名 patInfo,因此在显示操作中您必须使用:

render params.patInfo

例如,如果您将使用以下内容:

redirect(action:"display", params: [duck:patInfo])

您必须使用:

render params.duck
于 2013-07-31T22:09:07.200 回答