File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Writing JSON data back to client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Writing JSON data back to client" Watch "Writing JSON data back to client" New topic

Writing JSON data back to client

Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
I am following the steps given here to create an AJAX application using Dojo.

I have a java object : PaneLayout which I convert to JSONObject

In my JSP:

In CreateForm servlet:

I am sending back the string form of JSONObject (created by converting a PaneLayout object, as shown above)

The 'getPaneInfo(id)' function is called and it sends the request to servlet alright but no data is coming in showProperty function. I checked the value of 'data' and that is 'false'. So each time 'Damn' is getting printed.

I don't understand what can be wrong in this. Am I doing anything wrong while sending the data? What else can be wrong?

Please help me with this. Any pointers will help.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60782

Have you used a tool like Firebug to see what is being returned as the response of the Ajax request?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
Thanks for that suggestion Bear. I used Firebug to monitor the entire call.

And I could solve the error also.
In my servlet I was doing "response.sendRedirect(sSendTo);" to the JSP. Removing it worked!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Writing JSON data back to client
Similar Threads
Problem with
Reading a 'Collection' object from JSON
DOJO Grid and JSON
Can someone help me with the "new" dojo calls?
dojo and javascript DOM issue