[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

download a file by jsp

Hi, gurus,

A download function. Well, it can be done by using a hyper link, when user right click the mouse, they can save it by "save target as ".   I want to implement a function, when user click a button e.g. called download, then they can download it into client side. How to do this by jsp ?

Look forward to your reply. Thanks.
0
lilyyan
Asked:
lilyyan
  • 2
1 Solution
 
bloodredsunCommented:
Just change the mime-type

Try this example

downloadas.jsp
---
<%@ page contentType="application/none"%>
---
0
 
lilyyanAuthor Commented:
Well, I want the function will be:  when user click the file clink, a open/save dialogue window will pop up.

I tried this :
downloadas.jsp
----------
<%@ page contentType="application/none"%>
<input type="button" value=download> <a href="./test.doc">link</a> </input>
-----------

it turns out that when i access this file from the url, it directly pops up a window, " open/ save / ...". nothing else shown up in the page. use will not have much clue about this :(

an asp sample will also be helpful
0
 
bloodredsunCommented:
>>it turns out that when i access this file from the url, it directly pops up a window, " open/ save / ...". nothing else shown up in the page. use will not have much clue about this :(

Sorry, that's what I thought you asked for. You have a page full of links that start download when you click the button next to them using the above code.

and I can't help you with asp
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now