aspose file tools*
The moose likes Servlets and the fly likes open a file in browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "open a file in browser" Watch "open a file in browser" New topic
Author

open a file in browser

tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
i want to open a simple text file in browser but when i run the code it asks me to save the file instead of opening it in browser :



is it correct


Do Right , Fear No Man
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29249
    
139

Tushar,
Your Content-Disposition is telling the browser to save it as an attachment. If you use the inline content-disposition instead it won't force the save.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
Jeanne Boyarsky wrote:Tushar,
Your Content-Disposition is telling the browser to save it as an attachment. If you use the inline content-disposition instead it won't force the save.


yeah it is showing me what is there in infosupply.java(whose code i have given here) not from display.java which i want .

one more thing : it is showing me entire code of infosupply.java including <HTML><BODY> everything ..
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29249
    
139

You're going to need to show some more code. What are you writing out after you have the headers?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: open a file in browser
 
Similar Threads
File writer issue
while opening csv file, dialog box opens twice
File download with servlets
How to Return a File using Servlet
res.setContentType