如何从jsp上传文件夹中的所有内容 [英] how to upload all of the contents in a folder from jsp

查看:75
本文介绍了如何从jsp上传文件夹中的所有内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jsp和servlet将一个文件夹中的所有内容上载到服务器中的另一个文件夹.我已经有一个FileUpload,但是您可能知道我只能选择一个文件.有一些可行的方法吗?为了能够从jsp中选择文件夹而不是单个文件?

i'm trying to upload all of the contents in a folder to another folder in my server using jsp and servlets. I already got one FileUpload but as you may know i can only choose a single file. Is there some possible way to do this?? To be able to choose a folder instead of a single file from a jsp?

预先感谢

推荐答案

您需要意识到的第一件事是,JSP只是一种基于Java的视图技术,它允许您使用Java控制HTML/CSS/JS的输出.毕竟,只是HTML/CSS/JS才出现在网络浏览器中.在HTML中,无法选择要上传的文件夹. HTML <input type="file">根本不是为此目的而设计的. JSP对此无能为力.

First thing you need to realize is that JSP is just a Java based view technology which allows you to control the output of HTML/CSS/JS using Java. After all, it's just HTML/CSS/JS which ends up in the webbrowser. In HTML, there's no possibility to select a folder for upload. The HTML <input type="file"> simply isn't designed for that. JSP can't do much about it.

您最好的选择是使用 JFileChooser 设置为文件夹选择.您可以按照通常的HTML方式将其嵌入到JSP页面中.有几种可用的第三方小程序,您可以下载/购买并将它们嵌入到JSP中,但是不幸的是,它们都不是免费软件.

Your best bet is creating a Java applet utilizing JFileChooser which is set to folder selection. You can embed it in the JSP page the usual HTML way. There are several 3rd party applets available which you could just download/buy and embed it in the JSP, but unfortunately none of them is freeware.

  • MyUploader
  • Rad Upload
  • HTTP File Upload Applet
  • JavaPowUpload
  • JFileUpload

这篇关于如何从jsp上传文件夹中的所有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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