Search code examples
ajaxjsfrichfacestomahawk

tomahawk t:inputFileUpload not working


I have developed a jsf application with following facets

  • Dynamic Web Module 2.5
  • Java 5
  • JavaServer Faces 1.2
  • Rich Faces 3.3.2

I have a page with an t:inputFileUpload component. it was working fine till i added ajax and rich faces components and taglibs to my page. As follows:-

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>
...
<t:inputFileUpload...

All i want to ask is that, is it not possible that these taglibs can work together?

Thanks in advance.


Solution

  • It should work fine as long as you don't submit the form by ajax. It's namely not possible to upload files by ajax using the <t:inputFileUpload>. So, you need to make sure that you submit the form by a synchronous (non-ajax) request.

    You should also make sure that the Tomahawk's ExtensionsFilter is been registered in web.xml before RichFaces' org.ajax4jsf.Filter, otherwise it will consume the multipart/form-data request before Tomahawk's ExtensionsFilter get chance to do so.

    Alternatively, you could drop Tomahawk's <t:inputFileUpload> and use RichFaces' own <rich:fileUpload> instead. It's able to simulate a "ajax look-a-like" file upload using Flash.