• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Build Array in Servlet And Pass Back to Ajax Callback

 
Ranch Hand
Posts: 2201
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67734
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSON
 
Steve Dyke
Ranch Hand
Posts: 2201
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67734
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Well THAT's new! Comfort me, reliable tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic