Estou tentando retornar uma lista de objetos complexos pelo
AjaxConsequence.KEY de minha action, porém, só retorna até um certo nível do objeto...
passei a usar no application manager:
.ajaxOk( new JSONArrayAjaxRenderer())
só que como meu objeto tem um objeto do tipo Calendar, dá o seguinte erro:
#######################################3
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Exception while invoking action Disciplina: Exception while renderizing with render class org.mentawai.ajax.renderer.JSONArrayAjaxRenderer: net.sf.json.JSONException: net.sf.json.JSONException: java.lang.NoSuchMethodException: Property 'actualMaximum' has no getter method in class 'class java.util.GregorianCalendar' / org.mentawai.core.ConsequenceException / Property 'actualMaximum' has no getter method in class 'class java.util.GregorianCalendar' / java.lang.NoSuchMethodException
org.mentawai.core.Controller.service(Controller.java:665)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NoSuchMethodException: Property 'actualMaximum' has no getter method in class 'class java.util.GregorianCalendar'
org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1327)
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:770)
org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846)
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:426)
net.sf.json.JSONObject.fromBean(JSONObject.java:157)
net.sf.json.JSONObject.fromObject(JSONObject.java:230)
net.sf.json.JSONObject.setValue(JSONObject.java:463)
net.sf.json.JSONObject.fromBean(JSONObject.java:15 net.sf.json.JSONObject.fromObject(JSONObject.java:230)
net.sf.json.JSONArray.<init>(JSONArray.java:387)
net.sf.json.JSONArray.fromCollection(JSONArray.java:127)
net.sf.json.JSONArray.fromObject(JSONArray.java:147)
net.sf.json.JSONObject.setValue(JSONObject.java:455)
net.sf.json.JSONObject.fromBean(JSONObject.java:15 net.sf.json.JSONObject.fromObject(JSONObject.java:230)
net.sf.json.JSONArray.<init>(JSONArray.java:387)
org.mentawai.ajax.renderer.JSONArrayAjaxRenderer.encode(JSONArrayAjaxRenderer.java:49)
org.mentawai.ajax.AjaxConsequence.execute(AjaxConsequence.java:106)
org.mentawai.core.Controller.service(Controller.java:655)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.
Apache Tomcat/6.0.20
#######################################
Antes eu estava usando :
.ajaxOk( new JSONGenericRenderer(4));
mas mesmo assim apenas me retornava um objeto json com 3 niveis:
O objeto que deveria retornar seria de 4 niveis:
Eu percebi que fazendo um objeto que tenha como filho lista de outros objetos, ai funciona...Será que é um erro do JSONGenericRenderer(), ou uma necessidade de apenas conseguir construir objetos que tenha lista de objetos em todos os niveis como filhos?
Joined: 23/02/2007 17:22:13
Messages: 745
Location: São Paulo - SP - Brasil
Offline
O problema ai é que voce quer entrar dentro do objeto GregorianCalendar e serializar suas propriedades, quando na verdade o que voce quer e pegar o date e dar um toString não é isso?
Se for isso, talvez o que falte é o renderer quando encontrar um GregorianCalendar ele pegar o date e fazer o toString.
Entendi certo?
Robert Gil
Coordenador de Desenvolvimento / Administrador de Redes.
Twitter