GeeCON Prague 2014*
The moose likes JSP and the fly likes Build Array in Servlet And Pass Back to Ajax Callback Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Build Array in Servlet And Pass Back to Ajax Callback" Watch "Build Array in Servlet And Pass Back to Ajax Callback" New topic
Author

Build Array in Servlet And Pass Back to Ajax Callback

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1462
    
    1
I want to create an array in my Servlet and send return that array in my callback string. I will use the arry to display several pdf files.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61316
    
  66

JSON


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1462
    
    1
Bear Bibeault wrote:JSON


Okay this is part of my Servlet:



The jReturnString looks like this:

{"errorString": "NoError", "filePath": "["\/\/gvas400\/home\/ShippingDocssupport\/Temp\/ShippingDocs\/8130\/2011\/_185049_999999_SSR101911 CO185049_000143689.pdf","\/\/gvas400\/home\/ShippingDocssupport\/Temp\/ShippingDocs\/8130\/2011\/_185049_999999_SSR101911 CO185049_000143690.pdf","\/\/gvas400\/home\/ShippingDocssupport\/Temp\/ShippingDocs\/8130\/2011\/_185049_999999_SSR101911 CO185049_000143691.pdf"]"}

The JSON seems to be modifing the "\\"

Something is preventing my call back function from fireing.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61316
    
  66

Usually that means that the JSON is invalid.

I see that you are building your JSON by hand. Don't. Let a library such as Google's Gson handle the JSON conversion.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Build Array in Servlet And Pass Back to Ajax Callback