1

I am using Tomahawk's fileupload component <t:inputfileupload> for uploading files. I've set enctype of form as

enctype="multipart/form-data" 

and I used <h:commandButton> to submit the form.

But the UploadedFile property in the bean is null. What am I doing wrong and how can I fix it?

Fortega
  • 19,463
  • 14
  • 75
  • 113

3 Answers3

5

Ensure that you've configured the ExtensionsFilter as per their documentation. It's the one responsible for processing multipart/form-data requests and setting the appropriate parts as bean properties.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
1

Ensure that you are not using nested forms. Because upload component dont run in nested forms. It will throw null pointer exception.

Sun
  • 11
  • 1
  • That depends on the webbrowser used. Nested forms is namely disallowed by HTML specification and browser behaviour is unspecified. If upload doesn't work, then normal form components would also not run in nested forms. – BalusC Jan 21 '11 at 11:39
0

I got this issue when I had started on the basis of faces extensions -> the stuff where you put

<%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>

and use myfaces-extensions-1.0.9.jar.

There is a tutorial on that approach at onjava.com but the tutorial is from year 2005 and does not work with the current jsf1.2 versions. Being fighting with that very old solution tutorial found with google I realized it's worth of checking always that you're using uptodate tutorials also not just uptodate jar-versions.

I wanted to give this solution to those who also have started this thing from upside down.

mico
  • 12,730
  • 12
  • 59
  • 99