Primefaces fileUpload fileUploadListener问题
我想在我的页面中实现多个上传器。 我尝试使用 primefaces 实现,使用 2.2.1 版本,但没有成功。
xhtml页面中的代码:
<p:fileUpload fileUploadListener="#{actionsContainer.fileStorageActions.uploadListener}"
multiple="true" label="choose" allowTypes="*.jpg;*.png;*.gif;*.pdf;*.webm;*.flv" description="Images"/>
以及后端函数中的代码:
public void uploadListener(org.primefaces.event.FileUploadEvent event) throws CommonUtilsException {
log.write("Upload.");
}
我尝试按照文档中的说明进行操作,但即使如此,也未达到后端函数。关于我缺少什么的任何想法?
提前感谢
编辑: 正如我在其他线程中看到的,我添加了这个建议
<h:form enctype="multipart/form-data" prependId="false">
<p:fileUpload fileUploadListener="#{actionsContainer.fileStorageActions.uploadListener}"
multiple="true" label="choose" allowTypes="*.jpg;*.png;*.gif;*.pdf;*.webm;*.flv" description="Images"/>
</h:form>
结果是相同的
I would like to implement a multitiple uploader in my page.
I tryed with primefaces implementation, using 2.2.1 version with no success.
The code in the xhtml page:
<p:fileUpload fileUploadListener="#{actionsContainer.fileStorageActions.uploadListener}"
multiple="true" label="choose" allowTypes="*.jpg;*.png;*.gif;*.pdf;*.webm;*.flv" description="Images"/>
And the code in backend function:
public void uploadListener(org.primefaces.event.FileUploadEvent event) throws CommonUtilsException {
log.write("Upload.");
}
I tryed to follow the explanation in the documentations, but even though, the backend function is not reached. Any ideas about what I am missing??
Thans in advance
EDIT:
As I could see in other threads, I add this suggestion
<h:form enctype="multipart/form-data" prependId="false">
<p:fileUpload fileUploadListener="#{actionsContainer.fileStorageActions.uploadListener}"
multiple="true" label="choose" allowTypes="*.jpg;*.png;*.gif;*.pdf;*.webm;*.flv" description="Images"/>
</h:form>
The result is the same
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了解决方案。我需要编辑文件 web.xml,添加此过滤器:
我找到了这篇 文章< /a> 非常有用
I found the solution. I needed to edit the file web.xml, adding this filter:
I found this article very useful