File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes JDOM, and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JDOM, and JSP" Watch "JDOM, and JSP" New topic


Arthur Nyunt

Joined: Aug 01, 2001
Posts: 2
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

Joined: Jan 19, 2001
Posts: 338

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

Joined: Aug 01, 2001
Posts: 2
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 = File("xml/myFile.xml"));
Any suggestions?
I agree. Here's the link:
subject: JDOM, and JSP