In a Java web project, if you want to open a link(url, like
http://localhost:8080/pe/report/test.xls
, the file has been already created )to show test.xls excel file, maybe you just see some nonsense code. In order to resolve the problem, you have to add some config in web.xml:
<mime-mapping
>
<
extension
>
xls
</
extension
>
<mime-type>application/octet-stream</mime-type>
</mime-mapping
>
remember: the web.xml is not the file in your project, but a config file under the servlet container, for example JBoss, Tomcat.