How to serve a file with JSP?

后端 未结 4 1926
一个人的身影
一个人的身影 2021-01-17 23:56

This may sound totally stupid, but is a case of real life :(

I\'m able to display a HTML table with a \"virtual\" link name.

Something like this:

         


        
4条回答
  •  孤街浪徒
    2021-01-18 00:41

    You need to set the MIME type in the HTTP response like below in addition to the sample code you provided.

    response.setContentType("application/octet-stream");
    

    Note, the application/octet-stream MIME type is used to indicate a binary file.

提交回复
热议问题