如何在 RichFaces 4 中上传文件?
我需要在 JSF 2 中创建一个文件上传功能,因此我正在搜索它并找到 可以使用 Tomahawk,我认为这对于 JSF 2 来说不是很稳定。 我正在使用 RichFaces,因此我寻找它并 找到< /a> 这个我认为更简单,但我使用的是 richfaces 4.
所以我想知道是否有办法用 richfaces 4 来做到这一点,或者只用 JSF 2 来做到这一点。
有什么想法、建议吗?
I need to make a file upload function in JSF 2 so I was searching about it and found it is possible to do with Tomahawk, which I think is not very stable with JSF 2.
I'm using RichFaces, so I look for it and found this which I think more simple, but I'm using richfaces 4.
So I wonder if there's a way to do this with richfaces 4 or do this with JSF 2 only.
Any idea, suggestion ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在查看 RichFaces 3.3.x 演示站点。您需要查看 RichFaces 4.x 演示站点。
演示页面包含带有源代码的具体示例。要使用纯 JSF2 来完成此操作,您需要创建一个自定义组件并自行解析多部分/表单数据请求。有一个关于此的博客,其中包含完整且具体的示例: 使用 JSF 2.0 和 Servlet 3.0 上传文件。
使用战斧只会更容易。我不知道为什么你认为它不太稳定。
You're looking at RichFaces 3.3.x demo site. You need to look at RichFaces 4.x demo site. The
<rich:fileUpload>
demo page contains a concrete example with source code.To do it with pure JSF2, you'd need to create a custom component and parse the multipart/form-data requests yourself. There's a blog about this with complete and concrete examples: Uploading files with JSF 2.0 and Servlet 3.0.
Using Tomahawk is only more easy. I'm not sure why you think that it's not very stable.