File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to display XML documents using JSP?

 
Rudy Rusli
Ranch Hand
Posts: 114
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to provide data to clients by providing them a URL to my jsp page.

The JSP page will get all the data from a table in database and display the data as an xml.

The data created okay and client's program can access it fine.

The problem is when I try to open the JSP page in the browser, it doesn't look like XML at all. I think it's because the "open" and "close" tag in XML documents.

How could I handle this so people can view the data in their browser?

Thanks in advance for the advice.

- Rudy -
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XML isn't a display format, so it's not clear at all what you mean by "display the XML".

What is it you are trying to show them?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you setting the content type to "text/xml"?
 
Rudy Rusli
Ranch Hand
Posts: 114
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to display data from a table in DB and display it in XML format
so the jsp page should print out something like:



How can i set the content type to text/xml?

Thanks for the help.
- Rudy -
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For this you can create an XML file and make a link to that. Browser will show it as it would be.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic