在 JSP/Servlet 中管理文件上传 [英] Managing file uploads in JSP/Servlets
问题描述
又是一个非常初学者的问题,但我开始了:
Once again a very beginner-ish question, but here I go:
我想使用 servlet 或类似工具将上传的文件(从 html 文件选择)复制到永久位置.这就是我需要对文件做的所有事情.我目前正在使用 Apache Commons FileUpload 和 IO 库.没有更简单或更优雅的解决方案吗?
I would like to use a servlet or similar to copy an uploaded file (from an html file select) to a permanent location. This is all I need to do with the file. I am currently going with using the Apache Commons FileUpload and IO libraries. Is there no easier or more elegant solution?
推荐答案
如果您使用纯 JSP 和 servlet,Apache commons FileUpload 可能是最好的方法.如果您使用像 struts2 这样的框架,您将有更多选择,因为它们内置了文件上传组件并且非常易于使用.
The Apache commons FileUpload is probably the best way if you are using pure JSP and servlets. If you use a framework like struts2 you will have some more options since they have file upload components built in and are very easy to use.
这篇关于在 JSP/Servlet 中管理文件上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!