带有fieldValue的Grails循环
我知道如何使用带有fieldValue的Grails循环,grails,gorm,Grails,Gorm,我知道如何使用g:each标记在template.gsp中使用fieldValue()。但是,如果在控制器中循环返回的数据库信息,如何使用它呢 def retObj=[]; for( x in returnedFromDataBase){ var current=retObj.push([:]); //how do I make this get the value of the current row using fieldValue?? current.myname=
g:each
标记在template.gsp中使用fieldValue()。但是,如果在控制器中循环返回的数据库信息,如何使用它呢
def retObj=[];
for( x in returnedFromDataBase){
var current=retObj.push([:]);
//how do I make this get the value of the current row using fieldValue??
current.myname=fieldValue(bean:returnedFromDataBase, field: "name")
}
fieldValue()应该具有更好的sql注入保护??fieldValue可以保护您免受XSS注入。