Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

display DOM document

 
thomas wilson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the best way to display a DOM (Document Object Model) document next to a button in jsp? Can I store a DOM document in session variable then display it that way? Thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly are you trying to do here? Display an XML Document literal text, or do you mean DOM in the Javascript/HTML sense?
Bill
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
create a servlet that uses an XMLSerializer (or whatever your XML parser calls it, that's the name Xerces uses) to serialize the XML to the servlet output stream (after setting the proper content type of course).
Call the servlet from the button.

And yes, you can pass the DOM Object in the HTTP session this way.

I did exactly this today. Took about half an hour including 10 minutes to write the JSP and make the button graphics and 5 minutes to test if it worked.

You need all of 8 lines of Java code (plus some imports) when using Xerces 2.6.
When using old Xerces versions, you might need hundreds of lines as it didn't have a mechanism to serialise XML.
 
My, my, aren't you a big fella. Here, have a tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!