我们如何将jsp导出到doc文件? [英] How can we export jsp to doc file?

查看:98
本文介绍了我们如何将jsp导出到doc文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用内容类型将jsp导出到doc文件?

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

推荐答案

您可以通过

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

response.setContentType("application/msword");

您将要确保除了构成Word文档的数据之外,不要从JSP输出任何内容.然后您将要检查该MIME类型; 以上是我的来源,它是针对Word文件的一种变体,但我认为我找不到的更规范的MIME类型(使用"vnd").并且.docx文件的类型不同, Microsoft在这里说是<深呼吸> application/vnd.openxmlformats-officedocument.wordprocessingml.document.

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.

这篇关于我们如何将jsp导出到doc文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆