Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

open a file in browser

 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34393
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34393
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're going to need to show some more code. What are you writing out after you have the headers?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic