• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to invoke file downloading from the JSP?

 
Andriy Vasylyev
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
I have an InputStream in my session. It's a stream from CLOB data from DB.
Can I invoke file downloading from the JSP of this data?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never tried stuff like this in a JSP, I always do it in a servlet. Just get a Stream from the source, get the OutputStream to the client, then pipe them together.
Dave
 
Andriy Vasylyev
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that most common way is to use Servlet. The Idea is - is it possible to set proper contentType of JSP to call downloading binary data in file. (I think download window).
 
Andriy Vasylyev
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have found a decision of my problem:
Just create JSP and set:
<% response.setContentType("bin/std"); %>
<% response.addHeader("Content-Disposition","attachment;filename=test.std")); %>
and write here stream into jsp Out!
AV. Thanks me and my colleagues.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!