jsf2.0 文件上传组件

上传者: hblty | 上传时间: 2022-05-14 03:09:13 | 文件大小: 376KB | 文件类型: RAR
由于JSF2.0标准实现没有提供文件上传组件,而实际应用中很多时候需要上传文件,为了方便开发,我做了一个基于JSF2.0的文件上传组件,上传使用的是Apache 的commons-fileupload组件,我已经将commons-fileupload-1.2.1.jar和commons-io-1.3.2.jar打包成一个lfaces.jar文件,使用时无需导入这两个jar文件,我使用的是Facelets技术,使用时很简单,导入命名空间后就可以使用标签()了,这个标签和标签使用方法一样,具体请参考例子。补充说明:是以临时文件存放在服务器上的,上传后需要自行处理,响应之前(JSF处理完毕)将会删除该临时文件,要设置上传的参数,比如文件存放目录,上传大小等,请在源目录(src)下建一个名为uploadfile.properties的文件,内容如下: #设置用于存放用户上传的文件夹,可以是绝对路径,例:C:/upload,也可是相对路径,例:/upload, #文件上传后是以.tmp为后缀的临时文件存储在服务器上,请求处理完成后系统将自动删除该临时文件,需要自行保存文件到需求的目录 uploadFile.path=E:/ #设置上传文件总大小的上限 uploadFile.sizeMax=1024*1024*50 #设置上传文件大小的上限 uploadFile.fileSizeMax=1024*1024*10 #设置缓存大小,如果文件大于缓存大小时,则先把文件放到缓存中 uploadFile.sizeThreshold=1024*1024 #设置上传文件类型 uploadFile.extFilter=.jpg|.jpeg|.gif|.bmp|.png|.xls|.doc|.txt

文件下载

资源详情

[{"title":"( 23 个子文件 376KB ) jsf2.0 文件上传组件","children":[{"title":"fileUpload","children":[{"title":"test","children":null,"spread":false},{"title":"src","children":[{"title":"conf","children":[{"title":"MANIFEST.MF <span style='color:#111;'> 25B </span>","children":null,"spread":false}],"spread":true},{"title":"java","children":[{"title":"cn","children":[{"title":"FileUpload.java <span style='color:#111;'> 532B </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true},{"title":"web","children":[{"title":"WEB-INF","children":[{"title":"sun-web.xml <span style='color:#111;'> 521B </span>","children":null,"spread":false},{"title":"web.xml <span style='color:#111;'> 967B </span>","children":null,"spread":false},{"title":"lib","children":[{"title":"lfaces.jar <span style='color:#111;'> 211.00KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"index.xhtml <span style='color:#111;'> 638B </span>","children":null,"spread":false}],"spread":true},{"title":"build","children":[{"title":"web","children":[{"title":"WEB-INF","children":[{"title":"sun-web.xml <span style='color:#111;'> 521B </span>","children":null,"spread":false},{"title":"web.xml <span style='color:#111;'> 967B </span>","children":null,"spread":false},{"title":"lib","children":[{"title":"lfaces.jar <span style='color:#111;'> 211.00KB </span>","children":null,"spread":false}],"spread":true},{"title":"classes","children":[{"title":"cn","children":[{"title":"hb84","children":[{"title":"faces","children":[{"title":"component","children":null,"spread":false},{"title":"upload","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"FileUpload.class <span style='color:#111;'> 861B </span>","children":null,"spread":false}],"spread":true},{"title":".netbeans_update_resources <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"jdcxt","children":[{"title":"jsf","children":[{"title":"component","children":null,"spread":false}],"spread":false},{"title":"upload","children":null,"spread":false}],"spread":true},{"title":".netbeans_automatic_build <span style='color:#111;'> 0B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"gfv3ee6.dpf <span style='color:#111;'> 521B </span>","children":null,"spread":false},{"title":"META-INF","children":[{"title":"MANIFEST.MF <span style='color:#111;'> 25B </span>","children":null,"spread":false}],"spread":true},{"title":"index.xhtml <span style='color:#111;'> 638B </span>","children":null,"spread":false}],"spread":true},{"title":"generated-sources","children":[{"title":"ap-source-output","children":null,"spread":false}],"spread":true},{"title":"empty","children":null,"spread":false}],"spread":true},{"title":"build.xml <span style='color:#111;'> 3.42KB </span>","children":null,"spread":false},{"title":"nbproject","children":[{"title":"build-impl.xml <span style='color:#111;'> 52.64KB </span>","children":null,"spread":false},{"title":"private","children":[{"title":"private.xml <span style='color:#111;'> 498B </span>","children":null,"spread":false},{"title":"private.properties <span style='color:#111;'> 414B </span>","children":null,"spread":false}],"spread":true},{"title":"ant-deploy.xml <span style='color:#111;'> 5.05KB </span>","children":null,"spread":false},{"title":"project.properties <span style='color:#111;'> 4.52KB </span>","children":null,"spread":false},{"title":"project.xml <span style='color:#111;'> 884B </span>","children":null,"spread":false},{"title":"genfiles.properties <span style='color:#111;'> 473B </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}]

评论信息

  • love411896727 :
    然而并没有什么卵用
    2018-09-30
  • leicq :
    赞一个,都是封装request的原理
    2014-05-17
  • yyffcc :
    仅做参考用
    2014-04-02
  • oshazi :
    正好刚接触jsf需要这个
    2013-12-10
  • jave1988 :
    最近在用jsf,要上传文件,恰好可以用到。。
    2013-08-29

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明