gorm findAllBy里面的gsp怀疑

xai*_*ain 2 grails set grails-orm gsp

任何人都可以告诉我为什么这样有效

<g:each var="n" in="${com.pp.News.list()}">
 <h2>${n.t}</h2>
 <p>${n.tx}</p>
</g:each>
Run Code Online (Sandbox Code Playgroud)

但这不是吗?

<g:set var="news" value="${com.pp.News.findAllByShow(true,[sort:'prio', order:'desc',max:5])}" />
<g:each var="n" in="news">
   <h2>${n.t}</h2>
    <p>${n.tx}</p>
  </g:each>
Run Code Online (Sandbox Code Playgroud)

部分例外是

Exception Message: No such property: t for class: java.lang.String 
Run Code Online (Sandbox Code Playgroud)

我怎样才能使它工作?

谢谢

Ric*_*oll 5

更改

<g:each var="n" in="news">
Run Code Online (Sandbox Code Playgroud)

<g:each var="n" in="${news}">
Run Code Online (Sandbox Code Playgroud)

您正在迭代"news"而不是news var中的返回结果.