Popular Datatable com list
07/08/2015 13:33
Boa tarde Pessoal
Estou tendo dificuldades para enviar minha lista para a tabela na GSP. eu gero o sql, insiro ele em uma list<classe> que só tem atributos e os getters e setters, depois envio para a GSP , só que ele não encontra a propriedade. Alguém pode me dar uma luz?
PrincipalController.groovy
def caixaEntrada(){
List<ItensCaixaEntrada> itensCaixaEntrada = principalService.caixaEntrada()
println itensCaixaEntrada
render(view: 'index', model: [itensCaixaEntrada: itensCaixaEntrada])
}
PrincipalServices.groovy
@Transactional(readOnly = true)
def caixaEntrada(){
def session = sessionFactory.openSession()
def query = session.createSQLQuery("select tpj_descricao, prj_descricao, atv_assunto, atv_prioridade, atv_versao_prevista, sat_descricao, " +
"rep_datahora, atv_codigo, rep_codigo, horas_apropriadas, status_apropriacao, pro_descricao from fct_caixa_entrada(18, 1, 0, 0) order by atv_codigo desc")
def results = query.list();
return results
}
Table
<tbody>
<g:each var="itens" status="i" in="${itensCaixaEntrada}" >
<tr>
<td>${itens.tpj_descricao}</td>
<td>${itens.prj_descricao}</td>
<td>${itens.atv_assunto}</td>
<td>${itens.atv_prioridade}</td>
<td>${itens.atv_versao_prevista}</td>
<td>${itens.sat_descricao}</td>
<td>${itens.rep_datahora}</td>
<td>${itens.atv_codigo}</td>
<td>${itens.rep_codigo}</td>
<td>${itens.horas_apropriadas}</td>
<td>${itens.status_apropriacao}</td>
<td>${itens.pro_descricao}</td>
</tr>
</g:each>
</tbody>
</table>
Caused by MissingPropertyException: Exception evaluating property 'tpj_descricao' for java.util.Arrays$ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: tpj_descricao for class: java.lang.String
->> 6029 | getAtIterable in org.codehaus.groovy.runtime.DefaultGroovyMethods
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 6018 | getAt in ''
| 1831 | getProperty . . . . . . . . . . in groovy.lang.MetaClassImpl
| 1140 | getProperty in groovy.lang.ExpandoMetaClass
| 3690 | getProperty . . . . . . . . . . in groovy.lang.MetaClassImpl
| 1152 | getProperty in groovy.lang.ExpandoMetaClass
| 173 | getProperty . . . . . . . . . . in org.codehaus.groovy.runtime.InvokerHelper
| 33 | getProperty in org.codehaus.groovy.runtime.callsite.PojoMetaClassGetPropertySite
| 227 | callGetProperty . . . . . . . . in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 63 | doCall in C__GRAILAPP_tacactive_grails_app_views_principal_index_gsp$_run_closure2_closure9
| -2 | invoke0 . . . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke in ''
| 43 | invoke . . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke in java.lang.reflect.Method
| 1270 | jlrMethodInvoke . . . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
| 90 | invoke in org.codehaus.groovy.reflection.CachedMethod
| 324 | doMethodInvoke . . . . . . . . in groovy.lang.MetaMethod
| 1207 | invokeMethod in groovy.lang.MetaClassImpl
| 1110 | invokeMethod . . . . . . . . . in groovy.lang.ExpandoMetaClass
| 1016 | invokeMethod in groovy.lang.MetaClassImpl
| 423 | call . . . . . . . . . . . . . in groovy.lang.Closure
| 439 | call in ''
| 320 | evaluate . . . . . . . . . . . in org.codehaus.groovy.grails.web.pages.GroovyPage
| -2 | invoke0 in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke . . . . . . . . . . . . in ''
| 43 | invoke in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke . . . . . . . . . . . . in java.lang.reflect.Method
| 1270 | jlrMethodInvoke in org.springsource.loaded.ri.ReflectiveInterceptor
| 90 | invoke . . . . . . . . . . . . in org.codehaus.groovy.reflection.CachedMethod
| 324 | doMethodInvoke in groovy.lang.MetaMethod
| 1207 | invokeMethod . . . . . . . . . in groovy.lang.MetaClassImpl
| 1110 | invokeMethod in groovy.lang.ExpandoMetaClass
| 1016 | invokeMethod . . . . . . . . . in groovy.lang.MetaClassImpl
| 1111 | invokeMethod in ''
Tags:
Caused by MissingPropertyException: