Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDOM, and JSP

 
Arthur Nyunt
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm using Tomcat to produce jsp which I want to be able to output and read XML. I have written my code using JDOM which works when the JSP isn't connected to it (i.e. in a separate file and using a command line interface to test it). However, once I link it up to my JSP pages I get little or no XML reading / writing. Does anyone know why this is?
 
Andrew Shafer
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Cause you are doing something wrong. . .
Can't be sure from your post what it is though. Have you tried viewing the source generated by your jsp/servlet? That's the first place to look when a JSP doesn't act the way you think it should.
 
Arthur Nyunt
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I think I have somethimg more specific for you. I have used JDOM to read my XML from the command line with no problem. I Then ported the code (cut and paste) to a Java Servlet. Within the try block of the servlet I added a simple "Hello World" type html code using print writer as a test at the end of the code, concerning JDOM. I have now found that if I comment out all but the first line of code cocerned with reading the XML (SAXBuilder builder = new SAXBuilder() ; ) The Hello World message is displayed. The servlet appears to not like the next line when I included the program line by line (for debug)
Document aDocument = builder.build(new File("xml/myFile.xml"));
Any suggestions?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic