Listener of FileUpload is never call
legalum Mar 8, 2012 3:39 AMHi all,
I need your help because i'm stuck with a richface functionnality.
I'm just trying to set up a simple File upload with the component <rich:FileUpload>, but after reading and following the documentation for this component, the listener from the bean is never call when an upload is finish. and the component display "DONE" when the file is upload.
Debugger don't shows any errors from the code. It's maybe a conflit between SWF and Richfaces.
My configuration :
RichFaces 4.2.0.Final
SpringMVC
SpringWebFlow 2.3.0.RELEASE
JSF 2.0
accueil.xhtml :
<rich:panel> <h:form> <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}" id="upload" acceptedTypes="jpg, gif, png, bmp" /> </h:form> </rich:panel>
flow.xml
<?xml version="1.0" encoding="UTF-8"?> <flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"> <secured attributes="ROLE_ADMIN,ROLE_FACULTYADMIN,ROLE_CHERCHEUR" match="any"/> <persistence-context/> <view-state id="accueil"> </view-state> </flow>
web.xml
<context-param> <param-name>org.richfaces.skin</param-name> <param-value>blueSky</param-value> </context-param> <context-param> <param-name>org.richfaces.fileUpload.maxRequestSize</param-name> <param-value>10000000</param-value> </context-param> <context-param> <param-name>org.richfaces.fileUpload.createTempFiles</param-name> <param-value>false</param-value> </context-param>
ImportCatalogue.java
package com.edhec.faculty.importCatalogue; import org.springframework.web.multipart.MultipartFile; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.Serializable; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Locale; import java.util.ResourceBundle; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import javax.faces.bean.SessionScoped; import javax.faces.bean.ViewScoped; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import org.richfaces.model.UploadedFile; import org.richfaces.event.FileUploadEvent; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; import org.apache.poi.poifs.filesystem.*; @ManagedBean @SessionScoped public class ImportCatalogue implements Serializable { private static final long serialVersionUID = 1L; public void listener(FileUploadEvent event) throws Exception { System.out.print("test"); try { POIFSFileSystem inputExcel = new POIFSFileSystem(); /*HSSFWorkbook workbook = new HSSFWorkbook(inputExcel);*/ } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Thanks for Helping