• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Sending & receiving 2d arrays from jersey to javascript  RSS feed

 
Ranch Hand
Posts: 209
13
VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a 2 dimensional array of strings in javascript, ie an array of arrays, that I'm wanting to fill with data that I GET from the server, update in javascript code and then PUT back.

It seems that to do this in Jersey, in my java code, I have to wrap the array in an object.


and make the object wrapping my String[][] available via http

When my String[][] looks like this:

doing a GET on the resource results in

Then, in my javascript code, I have to have functions that 'unwrap' the json into an array. Another js function does the opposite, takes a 2d array and returns an object that can be PUT back to the server.


This all works! However, I'm thinking that manually wrapping & unwrapping is just too much work and maybe jersey is somehow capable of doing it for me.

Is there a better technique?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!