I'm having problems with using multi-part form. I have started my project on TomEE 1.6 which came with the following JSF implementation:
myfaces-api-2.1.13
myfaces-impl-2.1.13
I read it's OK to upgrade JSF on TomEE so I replaced those two with:
myfaces-api-2.2.0
myfaces-impl-2.2.0
Unfortunately, multi-part form isn't working. When I use a simple form, the Save button goes into the bean target method properly. As soon as I add enctype="multipart/form-data"
to the form tag, the Save button no longer works. A request goes to the server but the target method isn't called. This, basically, results in a form refresh with all data lost.
My faces-config
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
My code
<h:form id="form" enctype="multipart/form-data">
<h:commandButton value="#{messages['common.buttonLabel.save']}" action="#{fileEditBean.save}" rendered="#{fileEditBean.hasSaveAction()}" />