0

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.

learner
  • 757
  • 2
  • 14
  • 35

2 Answers2

4

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • yes sir, i am using a4j:support in the selectOneMenu and submitting on change..any how. now i m gona do some thing about it in the light of ur guidance. – learner Jul 08 '12 at 04:43
  • @BalusC as a matter of curiosity, why does it not work when using ajax? – jwaddell Aug 27 '12 at 05:02
  • 1
    @jwa: Because `XMLHttpRequest` level 1 (as used by ajax4jsf) doesn't support `multipart/form-data` encoding, which is mandatory in order to be able to send files via a HTTP request. – BalusC Sep 06 '12 at 11:35
-1

Please make sure that you have an "encrypeType" in your form.

<h:form enctype="multipart/form-data">
Up_Router
  • 73
  • 9
  • Please read the question carefully. It says *"it was working fine till i added ajax and rich faces components and taglibs to my page"*. If the OP didn't use the proper `enctype`, it would impossibly have worked fine before. – BalusC Sep 06 '12 at 11:34