Method and example code of file download based on Java Web

Java Web implementation file download

Don't use the < a > tag to download. This will open the file instead of downloading it

For example:

< a href = "E: \ mydesktop \ 37fecd65330184de67d419a8d02e7081. JPG" > Download

If I write this, the browser will open the picture directly, unless it is a file that the browser can't open

So we still need to use Java's own file reading and writing to download files

< a href = "downloadfile? Filename = < s: property value ='document_filename '/ >" > Download

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>