This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
i devleoped code .i display the image file and pdf file displayed on the browser if i use internet explore. i use firefox ,just downloading. my code .please hlep to me. how display allfile formats on browser.give me source code. <%@ page language="java" %> <%@ page import="java.io.*"%>
what is methodreturnextension and methodreturninputstream ? it shows error, how to pass the filename into binarry inputstreamm.
i didnt get.
K Kiran Kumar
Ranch Hand
Joined: Jan 04, 2006
Posts: 109
posted
0
Hi Mohan,
methodreturnextension() is the extension of the file that you need to save it. methodreturninputstream() is the method where in which you need to convert your file contents to binary stream.
You need to understand how they have implemented in their scenario and try to implement the same in your scenario. Check in google and be patient on the way to crack the solution.
One source of problems might be that you misspelled the Content-Disposition header value. It's called "attachment", not "attachement".
But if you want to display files in the browser you should use "inline" instead. Note that the user may have set the browser to not open certain file types, and save them to disk instead. There's nothing the web app can do about that.
Furthermore, streaming files from a JSP page is bound to cause problems, because JSPs are meant for outputting text, not binary data. You should use a servlet instead. [ May 21, 2008: Message edited by: Ulf Dittmer ]
Furthermore, streaming files from a JSP page is bound to cause problems, because JSPs are meant for outputting text, not binary data. You should use a servlet instead.
Specifically, the JSP compiler injects its own whitespace characters into the output stream which almost always causes the downloaded file to be corrupt. We have an demo project in our CodeBarn that streams files from a servlet. See: http://faq.javaranch.com/java/CodeBarnSimpleStream