0

I have followed this tutorial from BalusC for FileUpload. but setter isn't getting called

2
  • Did you read the notice at the top of the article? That leads to this answer. So, are you following the tutorial or the Stackoverflow answer? Commented Sep 15, 2011 at 12:49
  • @Vineet: the difference is however pretty subtle. You only need other and more JARs for Tomahawk for JSF 2.0. Commented Sep 15, 2011 at 12:56

1 Answer 1

4

That can have the following causes:

  • The enctype="multipart/form-data" attribute is missing on the <h:form>. This is mandatory in order to be able to send files to the server.

  • The ExtensionsFilter is missing in web.xml or not properly mapped on the servlet name of the FacesServlet. This is mandatory in order to be able to parse the multipart/form-data request.

  • There is another filter in the request-response chain before the ExtensionsFilter which has already parsed the multipart/form-data request beforehand. For example, when you're using RichFaces4, such a filter will be auto-loaded without that you need to declare it in web.xml. Request bodies can be parsed only once, so the ExtensionsFilter would receive an empty request after such another filter.

  • There is another filter in the request-response chain before the ExtensionsFilter which has completely skipped the ExtensionsFilter by for example forwarding or redirecting the request.

Sign up to request clarification or add additional context in comments.

2 Comments

there was prettyfilter I swapped both of them still if I add enc-type it doesn't get submitted and if I remove that it gets submitted but no setter called
You must keep the enctype in the form. So, your concrete problem is that the form is not submitted at all? What exactly does not happen? Is the HTTP request not sent? Is the bean action method not invoked? Are you using Ajax to submit the form? You should not use Ajax for this. It has to be a plain vanilla synchronous form submit.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.