primeface handleFileUpload不会触发 [英] primefaces handleFileUpload doesn't trigger
本文介绍了primeface handleFileUpload不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图用primefaces fileUpload实现一个页面,但是我的handleUpload函数没有被触发。
My xhtml:
< h:form enctype =multipart / form-data>
< p:panel id =uploadFormPanelheader =文件上传>
< h:panelGrid columns =2style =margin-bottom:10pxcellpadding =5>
< h:outputText value =#{criteriaTranslation.questionaireFile}:/>
fileUploadListener =#{critereCSVImporter.handleFileUpload}
mode =advanced
allowTypes =/(\。| \ /)(CSV)$ //>
< / h:panelGrid>
< p:growl id =uploadMessagesshowDetail =true/>
< / p:面板>
< / h:表格>
我的支持bean:
@ManagedBean
@ViewScoped
public class CritereCSVImporter {
@Inject
private CriteriaBL criteriaBL;
private String OCRMODE;
public void handleFileUpload(FileUploadEvent event){
System.out.println(handle);
InputStream inputStream = event.getFile()。getInputstream();
我的web.xml:
< filter>
< filter-name> PrimeFaces FileUpload Filter< / filter-name>
< filter-class>
org.primefaces.webapp.filter.FileUploadFilter
< / filter-class>
< / filter>
< filter-mapping>
< filter-name> PrimeFaces FileUpload Filter< / filter-name>
< servlet-name> Faces Servlet< / servlet-name>
< / filter-mapping>
我错过了什么吗?
解决方案将commons-fileupload和commons-io jar放入你的lib文件夹中。 org / fileuploadrel =nofollow> Apache Commons FileUpload
I'm trying to implement a page with primefaces fileUpload but my handleUpload function isn't triggered. My xhtml:
<h:form enctype="multipart/form-data">
<p:panel id="uploadFormPanel" header="File upload">
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
<h:outputText value="#{criteriaTranslation.questionaireFile}:" />
<p:fileUpload update="uploadMessages"
fileUploadListener="#{critereCSVImporter.handleFileUpload}"
mode="advanced"
allowTypes="/(\.|\/)(csv)$/"/>
</h:panelGrid>
<p:growl id="uploadMessages" showDetail="true"/>
</p:panel>
</h:form>
My backing bean:
@ManagedBean
@ViewScoped
public class CritereCSVImporter {
@Inject
private CriteriaBL criteriaBL;
private String OCRMODE;
public void handleFileUpload(FileUploadEvent event) {
System.out.println("handle");
InputStream inputStream = event.getFile().getInputstream();
}
My web.xml:
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>
org.primefaces.webapp.filter.FileUploadFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
Am I missing something?
解决方案
Place commons-fileupload and commons-io jars in your lib folder
这篇关于primeface handleFileUpload不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文