• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sending xml to servlet

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey all,

I have an xml document containing data in html page, and I would like to send that to a servlet.

I'm thinking I can do it one of two ways.

ONE:



I have seen supposedly working examples of this, but they were IE specific, and I'm looking for something that complies w/w3c.

and then on servlet I do something like:




I have a feeling that I need to alter the setRequestHeader, so any suggestions would be helpful.

The other way I think would be possible would be to turn the xml doc into a string and send it like this:



and then do something on servlet like:




problem w/this is xmldoc doesn't have toString().

Any help (thoughts, comments, examples, good references) would be appreciated.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As to the client side in the browser, any code that does this will have some IE-specific stuff; that's just how XMLHttpRequest is implemented. But that's generally abstracted away by the thinnest layer on top of it; see this for code that works in all browsers.
 
David Westbrook
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have it working perfectly. I will post more details when I get the time. Check back in a couple of days if you're interested.
[ January 02, 2009: Message edited by: David Westbrook ]
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Glad to hear that you have it working. One thing you might want to consider, XML compresses well, there is lots of redundancy, so the built in Java gzip code can save a lot of time and bandwidth.
 
It will give me the powers of the gods. Not bad for a 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