Grails 控制器错误
def results = {
def results = [:]
def conferences = Conference.list() // lista das conferencias
String [] conf_origin // array de strings da indexação da classe
String [] conf_search = params.conferenceName.split() // array de strings palavras da pesquisa
boolean test // teste double for
conferences.each{
conf_origin = "hi i'm john".split() // indexação
//conf_origin = "aveiroa".split()
OUTER: for(int i = 0; i< conf_origin.length; i++){
for(int j = 0; j< conf_search.length; j++) {
if(conf_origin[i] == conf_search[j]){
test = true
results.put(it.id, it)
break OUTER;
}
}
}
}
return [results : results]
}
嘿我有这个问题。如果我返回:“[会议:会议]”我的 gsp 成功地完成了我想要的操作。尽管如此,当我返回“[结果:结果]”(推测是经过过滤的会议地图)时,会显示以下错误,我无法弄清楚原因:
Exception Message: No such property: yearCount for class: java.util.LinkedHashMap$Entry
PS。基本上,我有
String [] conf_origin --->这是一个字符串数组
String[]conf_search --->这是搜索栏中引入的单词的字符串数组。
然后我比较两个数组,如果有一个匹配,我会中断 for 并将该会议对象添加到结果中。
def results = {
def results = [:]
def conferences = Conference.list() // lista das conferencias
String [] conf_origin // array de strings da indexação da classe
String [] conf_search = params.conferenceName.split() // array de strings palavras da pesquisa
boolean test // teste double for
conferences.each{
conf_origin = "hi i'm john".split() // indexação
//conf_origin = "aveiroa".split()
OUTER: for(int i = 0; i< conf_origin.length; i++){
for(int j = 0; j< conf_search.length; j++) {
if(conf_origin[i] == conf_search[j]){
test = true
results.put(it.id, it)
break OUTER;
}
}
}
}
return [results : results]
}
Hey i am having this problem. If i return: "[conferences: conferences]" my gsp sucessfully do what i want. Altought, when i return '[results: results]' which is suposelly a filtered map of conferences, the folowing error is displayed and i cant figure it out why:
Exception Message: No such property: yearCount for class: java.util.LinkedHashMap$Entry
PS. Basically, i have
String [] conf_origin ---> which is a String array of words
String [] conf_search ---> which is a string array of introduced words in search bar.
Then i compare both arrays, and if there's one match, i break the for and add that conference object to results.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
conferences
是一个List
(属于Conference
,但在 Groovy 中是无类型的),results
是一个地图
。您需要:Conference
的List
[conferences: results.values()]
地图
上。请注意,
conferences
是您的 GSP 代码所依赖的变量名称。conferences
is aList
(ofConference
, but it's untyped in Groovy), andresults
is aMap
. You need either to:List
ofConference
[conferences: results.values()]
Map
.Note that
conferences
is a variable name your GSP code relies onto.