Reputation: 31
I am using JSF 2.0, and I have a form with a primefaces autoComplete (multiple) field, and a couple of file inputs. Since I'm using a file input, my h:form tag uses enctype="multipart/form-data" .
However, when I set my form to be multipart, my autocomplete field only returns the last item to my bean (the list is always of size 1). This issue also occurs when just using a regular multiple select element instead of the primefaces autocomplete (the autocomplete makes use of a hidden multiple select element). When I remove enctype="multipart/form-data", this issue goes away, but of course, my bean cannot detect the files I wish to upload.
Has anyone faced this issue and found a solution?
I am using: Liferay 6.1 GA2, Primefaces 3.5, Mojarra 2.1.21
Upvotes: 2
Views: 1493
Reputation: 16702
Anghel Leonard describes in article Uploading multiple files using pass through namespace (http://xmlns.jcp.org/jsf/passthrough
) to add multiple
attribute and overriding FileRenderer#decode method to extract uploaded files.
Upvotes: 1
Reputation: 446
I had the same problem with JBoss EAP 6.1. Turns out it's a bug in the implementation of the Request.java object which isn't fixed until Wildfly 8.x. Reference here: https://community.jboss.org/thread/223085
To get around this, I used a filter from BalusC's blog: http://balusc.blogspot.com/2007/11/multipartfilter.html
Note that even though JBoss is a 3.0 servlet spec, I couldn't use BalusC's related blog entry for 3.0 because of the bug.
Upvotes: 0
Reputation: 31
To anyone who is facing this issue, I would just like to share that I eventually turned to using jquery's autocomplete widget instead.
Upvotes: -1