5 Replies Latest reply on Jul 6, 2010 10:05 AM by Raul Valentini

    File Upload: unable to catch UploadEvent

    Raul Valentini Newbie

      Hi,

      I'm new in richfaces, and I'm trying to implement a simple page with a file upload.

      I've tried to use the source code of the example from richfaces live demo, but I've noticed he is using a seam listener.

      I don't want to use seam or other frameworks, but without that, at the end of the uploading file process, seems that no listener is listening to the UploadEvent.

      Indeed the method associated with the fileUploadListener attribute on the rich:fileupload component is never called.

       

      This is the code of my jsp (pasted from the live demo):

       

      <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
                      maxFilesQuantity="#{fileUploadBean.uploadsAvailable}"
                      id="upload"
                      immediateUpload="#{fileUploadBean.autoUpload}"
                      acceptedTypes="jpg, gif, png, bmp" allowFlash="#{fileUploadBean.useFlash}">
                      <a4j:support event="onuploadcomplete" reRender="info" />
      </rich:fileUpload>

       

      the method fileUploadBean.listener(UploadEvent event) is never called.

      This is my entire web.xml with a "ConfigureListener"... Must I declare another listener in the web.xml?

       

      <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>server</param-value>
         </context-param>
         <!-- Plugging the "Blue Sky" skin into the project -->
         <context-param>
            <param-name>org.richfaces.SKIN</param-name>
            <param-value>blueSky</param-value>
         </context-param>
         <!-- Making the RichFaces skin spread to standard HTML controls -->
         <context-param>
            <param-name>org.richfaces.CONTROL_SKINNING</param-name>
            <param-value>enable</param-value>
         </context-param>
         <!-- Defining and mapping the RichFaces filter -->
         <filter>
            <display-name>RichFaces Filter</display-name>
            <filter-name>richfaces</filter-name>
            <filter-class>org.ajax4jsf.Filter</filter-class>
         </filter>
         <filter-mapping>
            <filter-name>richfaces</filter-name>
            <servlet-name>Faces Servlet</servlet-name>
            <dispatcher>REQUEST</dispatcher>
            <dispatcher>FORWARD</dispatcher>
            <dispatcher>INCLUDE</dispatcher>
         </filter-mapping>
          <listener>
            <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
         </listener>
         <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>*.jsf</url-pattern>
         </servlet-mapping>
      </web-app>

       

      I'm using jsf with richfaces 2.0, eclipse and tomcat 6.0.

      I hope I mustn't use seam.

       

      Thank you in advance for any tip!

       

      Raul