First of all, I have to say, that I've read all (at least a lot :)) questions here and on primefaces forums about fileuploader issues.
My configuration:
Primefaces 4
JSF 2.2
Spring
Apache Tomcat 7
Maven
I am converting a richfaces project to primefaces, and I'm stuck with a fileUpload component that is not calling the handler method.
I have tried (altough I know that from Primefaces 4 it is not necessary) putting filters in the web.xml. I've also tried without filters. I have spring security filters and a language filter among some others, but the PF was first. I've also tried setting the dispatcher to FORWARD.
I have all the needed dependecies in Maven (commons - I know that from version 4 it is not required, but nevertheless I tried)
The xhtml part:
<h:form enctype="multipart/form-data">
... /* not relevant code here */ ...
<p:graphicImage value="#{systemParamsController.image}"
id="logo" />
<p:fileUpload
fileUploadListener="#{systemParamsController.listener}"
fileLimit="1" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
uploadLabel="#{msg['button.upload.jpg']}"
cancelLabel="#{msg['button.cancel']}"
invalidFileMessage="alert('#{msg['upload.invalidtype']}');"
update="logo" mode="advanced">
</p:fileUpload>
<p:growl id="messages" showDetail="true" />
</h:panelGrid>
</h:panelGroup>
<p:commandButton value="#{msg['button.save']}" onclick="this.disabled=true" oncomplete="this.disabled=false"
action="#{systemParamsController.save}" styleClass="qs-button"
ajax="false" />
</h:panelGrid>
</p:panel>
</center>
</h:form>
The backing bean:
public synchronized void listener(FileUploadEvent event) throws Exception {
logger.debug("uploadListener!");
UploadedFile item = event.getFile();
getModel().getCustomer().setLogo(imageResizer.doResize(item.getContents(), 30, Side.HEIGHT));
}
If I click on choose, I can select a file, but after that nothing happens. The handler is not called, because there is no log message, the upload file button is inactive. I have used this component before for more complex issues without problem, so I'm sure I'm missing something obvious.
Thanks in advance for any kind of help!