java上传word文档
我需要从用户上传的word文档中提取文本。我获得了code从位于我的m/c上的文档中提取单词的权限。但我的要求是允许用户使用上载按钮&;阅读该文档(我不需要保存该文档)。你能建议我怎么做吗?我需要知道点击上传按钮后需要发生什么
你可以在下面搜索框中键入要查询的问题!
我需要从用户上传的word文档中提取文本。我获得了code从位于我的m/c上的文档中提取单词的权限。但我的要求是允许用户使用上载按钮&;阅读该文档(我不需要保存该文档)。你能建议我怎么做吗?我需要知道点击上传按钮后需要发生什么
# 1 楼答案
当用户上传他们的文件时,抓取相关的
InputStream
并将其存储到变量中,如inputStream
。然后只需使用示例代码,替换这一行:。。。比如:
应该足够简单,假设你已经有一个
Servlet
来处理上传编辑:
假设您正在使用commons-fileupload解析上传,下面是servlet工作原理的基本知识: