I'm using primefaces 6.2.3 with apollo theme 2.0.1, tomcat 9.0 and java 9, spring and security 5.0.5
I want to add fileUpload to my xhtml page, but it does not call fileuploadlistener method from bean class.
Here is xhtml:
Code: Select all
<p:fileUpload
fileUploadListener="#{myBean.handleFileUpload}"
mode="advanced" auto="true"
sizeLimit="100000" allowTypes="/(\.|\/)(csv|doc)$/" />
Code: Select all
<h:form id="formAddWorkout" enctype="multipart/form-data" >
Method in BeanClass:
Code: Select all
public void handleFileUpload(FileUploadEvent event) {
System.out.println("FİLE UPLOAD Started");
}
I have also checked in forums, and I have added below codes to my web.xml.
I have tried with and without <dispatcher>FORWARD</dispatcher>, but result does not change.
web.xml:
Code: Select all
<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>
<!-- <dispatcher>FORWARD</dispatcher> -->
</filter-mapping>
Here is other config parts of my web.xml:
Code: Select all
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
I have also changed META-INF/context.xml, and added below line:
Code: Select all
<Context allowCasualMultipartParsing="true">
</Context>
Unfortunately, none of them changed the result.
I'm using fileUpload in my other project, java8, tomcat 8.5, primefaces 6.1.8 , apollo 1.0.3, and it works spring 4.2.0 and spring security 4.0.2
And it works fine.
I could not find any reason that causes not invoke fileuploadlistener.
Any idea, will be very helpful
Thanks,