管理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?
推荐答案
Apache的公共文件上传可能是最好的方式,如果您使用的是纯JSP和servlet。如果你使用像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屋!