Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to open an XML response in a browser?  RSS feed

 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi-
I have a jsp which returns an well-formed xml response as a string.
I want to have the browser open it as a doc so the user can view it.
Can someone please tell me how to do this?
thanks
Max
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37222
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Max,
If the user's browser supports XML, all you have to do is set the MIME type on your response header. If the user's browser does not support the XML type, there is no way to display XML in browser (unless you return it in preformatted text in HTML.)

In other words, you can suggest the XML be displayed, but not guarantee it.
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne-
Thanks for the response -
works perfectly
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!