[Logo] Mentawai Forum - Mentawai Web Framework
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 

Forum Read-Only! Check the new site and forum here!

Retorna uma string JSON sobre SUCCESS - [RESOLVIDO]  XML
Forum Index -> Comentários Gerais
Author Message
haboreh


[Avatar]

Joined: 14/10/2007 18:36:52
Messages: 76
Offline

Oi amigos,

Eu estou usando uma classe Java para retornar uma string JSON em minha página.

Eu estou usando o seguinte no meu libs / WEB-INF/lib:

Code:
 mentawai.jar
 json.jar
 json-lib-2.4-jdk15.jar
 


Meu controlador:
Code:
      public void loadActions() 
      {
     	 ActionConfig action001 = new ActionConfig("/GetDataGrid", com.kendoui.GetDataGrid.class);
     	 action001.addConsequence(com.kendoui.GetDataGrid.SUCCESS,  new StringConsequence(AjaxConsequence.OBJECT));   	     	     	
          addActionConfig(action001);                 
      }  
 


Minha classe java:
Code:
 	public String execute() throws Exception 
 	{		
 		JSONObject object = new JSONObject();
 		object.put("ProductID",new Integer(3));
 		object.put("ProductName","Aniseed Syrup");
 		object.put("UnitPrice",new Double(100.00));
 		object.put("UnitsInStock",new Integer(13));
 		object.put("Discontinued",false);
 		 
  		output.setValue(AjaxConsequence.OBJECT, object.toString());
  		return SUCCESS;
  		 		
 	}	
 


No entanto, quando eu chamar a classe Java como: http://localhost:8080/site/GetDataGrid.action, recebo o seguinte erro:

Code:
 root cause 
 java.lang.NoSuchMethodError: net.sf.json.JSONObject.put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
 	com.kendoui.GetDataGrid.execute(GetDataGrid.java:31)
 	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 	java.lang.reflect.Method.invoke(Unknown Source)
 	org.mentawai.core.InvocationChain.invoke(InvocationChain.java:307)
 	org.mentawai.core.Controller.invokeAction(Controller.java:849)
 	org.mentawai.core.Controller.service(Controller.java:709)
 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 


Por favor, informe - obrigado, Leo
Lobo


[Avatar]

Joined: 23/01/2006 02:17:14
Messages: 840
Location: Fortaleza-CE
Offline

Terminei de ler o post e ficou resolvido, ainda bem.

Atenciosamente,
Hélio Frota

Helio Frota
10+ Java Programmer
heliofrota.com

Member
Mentawai Developer
 
Forum Index -> Comentários Gerais
Go to:   
Powered by JForum 2.1.6 © JForum Team