<rich:fileUpload> with MyFaces

RichFaces FAQRichFaces Components FAQ Input and select components

 

Almost all the problems related to non working FU component just caused by wrong application configuration. We declared in documentation that RF filter could be called first before other application filters. And according to:

The ordering of the filters in list is determined by the following sequence:

Filters where the filter-mapping contains a url-pattern that matches the request are added
to the chain in the order they appear in the web.xml deployment descriptor. 

Filters where the filter-mapping contains a servlet-name that matches the request are
added to the chain after the filters that match a URL pattern. 

The last item in the chain is always the originally requested resource.

the web.xml should be:

<!-- Ajax4jsf Filter --
<filter>
     <display-name>Ajax4jsf Filter</display-name>
     <filter-name>ajax4jsf</filter-name>
     <filter-class>org.ajax4jsf.Filter</filter-class>
     <init-param>
          <param-name>createTempFiles</param-name>
          <param-value>true</param-value>
     </init-param>
     <init-param>
          <param-name>maxRequestSize</param-name>
          <param-value>20000000</param-value>
     </init-param>
</filter>
<!-- MyFaces ExtensionsFilter -->
<filter>
     <filter-name>extensionsFilter</filter-name>
     <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
     <init-param>
          <description> Set the size limit for uploaded files. Format: 10 - 10
               bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB </description>
          <param-name>uploadMaxFileSize</param-name>
          <param-value>100m</param-value>
     </init-param>
     <init-param>
          <description> Set the threshold size - files below this limit are
               stored in memory, files above this limit are stored on disk. Format:
               10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB </description>
          <param-name>uploadThresholdSize</param-name>
          <param-value>100k</param-value>
     </init-param>
</filter>
<filter-mapping>
     <filter-name>ajax4jsf</filter-name>
     <servlet-name>Faces Servlet</servlet-name>
     <dispatcher>REQUEST</dispatcher>
     <dispatcher>FORWARD</dispatcher>
     <dispatcher>INCLUDE</dispatcher>
     <dispatcher>ERROR</dispatcher>
</filter-mapping>
<filter-mapping>
     <filter-name>extensionsFilter</filter-name>
     <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>