• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding the file download functionality.

 
Tejas Gokhale
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my project we are using JSP as a view for struts framework.
I need to provide a functionality of file download wher-in user clicks on a link and he is directed thru normal download routine where he is asked the location he wants to save the file.The file then has to be downloaded on his machine at the location he had specified.
Any clues how to do this?? is JSP.
Any sort of help would be gr8.

Regards,
Tejas Gokhale
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You create a link to the file using the <a> tag.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Tejas Gokhale
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with the anchor tag is that if the resource is a zip file it asks for location to download.
But resource is a pdf it is opened in line in the browser itself.(in that case client can do save as but that is not desirable)
The req. is that for pdf also it should ask for location to download similar to a zip file.
Please help.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you want more control you'll need to stream the data using a servlet where you will be able to set the content disposition header to suit your needs.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!