简体   繁体   English

如何使用jsf上传文件?

[英]How to upload file with jsf?

一个严重的限制是我不能使用Tomahawk或RichFaces或其他任何东西。

Apache-Commons提供了FileUpload的实现,用于符合JSR 53的servlet.http://commons.apache.org/

If you're already on JSF 2.0 and Servlet 3.0, then you can create a custom component for that based on the plain vanilla Servlet 3.0 API: Uploading files with JSF 2.0 on Servlet 3.0 . 如果你已经在JSF 2.0和Servlet 3.0上,那么你可以基于普通的Servlet 3.0 API为它创建一个自定义组件: 在Servlet 3.0上使用JSF 2.0上传文件

If you're still on Servlet 2.5 or older, then you need to do more work. 如果你仍然使用Servlet 2.5或更早版本,那么你需要做更多的工作。 Tomahawk has done perfect work with that, so I really don't see any reason why you don't want to make use of it. 战斧已经做了完美的工作,所以我真的没有任何理由为什么你不想使用它。 If the actual problem is that you can't get it to work at all or have somehow an aversion against "3rd party component libraries", then just don't try it the hard way. 如果实际的问题是你根本无法让它工作或以某种方式厌恶“第三方组件库”,那么就不要以艰难的方式尝试。 Using Tomahawk is pretty easy: Uploading files with JSF . 使用Tomahawk非常简单: 使用JSF上传文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM