2 Replies Latest reply on May 25, 2010 6:25 AM by Nick Belaevski

    RF 3.3.1 - rich:fileUpload - no listener called + submit instead of ajax call

    ?ukasz Wachowicz Newbie

      Hi there,

       

      I have a problem using rich:fileUpload component. I can't get it to work properly. I want to place fileUpload in rich:modalPanel. Generally it works, but server side processing does not.

       

      when i do "Upload" whole page is being refreshed (instead of sending Ajax request) and fileUploadListener is not called. I tried the following:

       

      <h:panelGroup id="emptyPanelPreventsPageReload" />
      <h:form>
          <rich:fileUpload fileUploadListener="#{browserDataBinder.listener}" acceptedTypes="png" maxFilesQuantity="1" listHeight="150">
              <a4j:support event="onuploadcomplete" reRender="emptyPanelPreventsPageReload" />
          </rich:fileUpload>
      </h:form>

       

      or simply:

       

      <h:form>
          <rich:fileUpload fileUploadListener="#{browserDataBinder.listener}" acceptedTypes="png" maxFilesQuantity="1" listHeight="150" />
      </h:form>

      My Java side looks like:

       

      public class BrowserDataBinder {

           public void listener(UploadEvent event) throws Exception {
              UploadItem uploadedItem = event.getUploadItem();

           }

      }

       

      web.xml has two following rich entries

       

      <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>

      <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>

      I have Ajax in many other places in my application. It simply works. This is the first time i have problems with rich faces.

       

      Maybe some of you had similar issues. I didn't find anything on the internet. Thanks in advance for any hints ...

       

      Lukasz