0
將方法的參數保存到另一個方法中。在控制器中將參數從一種方法傳遞到另一種方法
在我的方法saveperson
中保存人員的參數在我的def contentPerson
中。有誰知道如何保存參數 - 沒有發現我的方法的savework
def saveperson(Person personIntance) {
def contentPerson =personInstance.save(flush:true)
redirect(controller:'Person', action:'creatework')
flash.message="I automatically select the person id";
}
def savework(Work workInstance,contentPerson) {
def work1 = new Work(name:params.name,person:contentPerson, profession:params.profession)
work1.save(flush:true)
}
消息:
沒有這樣的屬性:
contentPerson
您是否將它用作腳本?或上課?因爲'contentPerson'不在範圍內。 – Rao
你打電話給'savework()'的地方? – doelleri
您可以通過包括如何調用它來更新該文章嗎?全堆棧跟蹤? – Rao