Meaningless Drivel is fun!*
The moose likes JSP and the fly likes JSP and XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP and XML" Watch "JSP and XML" New topic
Author

JSP and XML

Dan Taylor
Greenhorn

Joined: Apr 16, 2004
Posts: 10
I am a newbie to JSP and frankly I don't know how to do much with it. I recently completed a semester learning Java but we didn't cover servlets, beans, or JSP.

I need some simple instructions to perform a simple task in a JSP page.

I am being supplied an XML document and I need to generate an HTML report from the data contained in it.

My question is how do I get the data from the XML doc into my JSP page?

I have been trying to find a good resource but everything seems to point to custom tag libraries to JSTL and other things that I am completely unfamiliar with. This seems like it would be a simple process of pointing my JSP to the XML doc somehow and using the XML field tags as variables.

second, once I have figured out how to all that, how do I get it to pull the info multiple times to create a table of information.

I hope this is simple and I am not asking a lot of anyone. I have a week to figure this out, code it and test it. Below is a copy of the sample XML I was provided:



thanks
Dan
[ May 24, 2004: Message edited by: Bear Bibeault ]
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
See DOM(Document Object Model) or SAX(Simple API for XML Parsing) to parse the XML file. To transform the XML into HTML see XSLT. Without these APIs i don't think you can solve the required problem.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Posting only a snippet of the XML would have been enough too, seeing as the data repeats itself [Bear: done]

As Ali suggests, look at XSLT to transform the data into HTML.
If you want to do that inside JSP, also look at the JSTL XML tags, which include XSLT support.
[ May 24, 2004: Message edited by: Bear Bibeault ]

42
Charles Hasegawa
Ranch Hand

Joined: May 22, 2003
Posts: 117
Well, the task you have is certainly simple, if you have experience in the various Java XML APIs and JSPs. Given what you described as your level of Java understanding, I'd say you are looking at a fairly tough task overall.

The easiest thing I can see you for you to do, is get the JSTL tag libaries and look at the XML related tags.

Here is a good starting reference: www.manning-source.com/books/bayern/bayern_apxA.pdf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP and XML
 
Similar Threads
handshake between sap xi & tomcat over https. no trusted certificate found
how to do record based index?
how to do record based index?
Can get the Form Feed "\f" to work!
How to read datas from xml in java