How can we export jsp to doc file?

左心房为你撑大大i 提交于 2019-12-12 07:00:41

问题


How can we export jsp to doc file using content type?


回答1:


You can set the content type of a JSP via setContentType:

response.setContentType("application/msword");

You'll want to be sure not to output anything from the JSP other than the data making up the Word document. And you'll want to check that MIME type; this is my source for the above, which is for one variant of Word files, but I think there's a more canonical MIME type I'm not finding (using "vnd"). And the type for .docx files is different, Microsoft says here that it's (deep breath) application/vnd.openxmlformats-officedocument.wordprocessingml.document.



来源:https://stackoverflow.com/questions/5948776/how-can-we-export-jsp-to-doc-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!