This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Servlets and the fly likes redirect the generated XML file to the browser using Java servelet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "redirect the generated XML file to the browser using Java servelet" Watch "redirect the generated XML file to the browser using Java servelet" New topic
Author

redirect the generated XML file to the browser using Java servelet

cake naiyou
Greenhorn

Joined: Apr 29, 2011
Posts: 27
I have a java program that can create a XML file and save it. Right now, I need to create a Java servelet, which enables the user to view this created XML file when clicking a button on the web. I would like to know how to do it with Java servelet programming.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18166
    
    8

Instead of saving it (which I assume means writing it to a FileOutputStream) just write it to the servlet response's output stream instead.

And of course you can't use the application (with its public static void main(args[]) method) as is, you would have to extract the XML-producing code from it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: redirect the generated XML file to the browser using Java servelet
 
Similar Threads
How to return an object to the user in the java server programming
how can i set caharcter encoding in js file
Servelet
how to send & by appending the URL
structure, path to a servlet