Note that there are some explanatory texts on larger screens.

plurals
  1. POGlassfish 4, JSF 2.2 and PrimeFaces FileUploadEvent not working together
    text
    copied!<p>After upgrading to GlassFish 4 and JSF 2.2 Primefaces FileUploadEvent stop working. With JSF 2.1 it was working with no problem. Everything is working fine except file uploading. Is there something that I am missing?</p> <pre><code> GlassFish 4 JSF 2.2 PrimeFaces 3.4.2 and 3.5 Commons io version: 2.4 Commons fileupload version: 1.3 </code></pre> <p>Controller side</p> <pre><code>public void handleFileUpload(FileUploadEvent event) { System.out.println("HandleFileUpload"); byte[] file = event.getFile().getContents(); newFieldset.setData(file); FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded."); FacesContext.getCurrentInstance().addMessage(null, msg); } </code></pre> <p>View </p> <pre><code>&lt;h:form enctype="multipart/form-data"&gt; &lt;p:fieldset legend="Create new feed" toggleable="true" collapsed="true" &gt; &lt;p:fileUpload fileUploadListener="#{adminHomeController.handleFileUpload}" style="margin-top: 20px;" mode="advanced" update="messages" sizeLimit="1000000" multiple="false" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/&gt; &lt;p:inputText label="Baslik" style="margin-top: 20px;" required="true" value="#{adminHomeController.newFieldset.legend}" /&gt; &lt;p:editor style="margin-top: 20px;" value="#{adminHomeController.newFieldset.content}" /&gt; &lt;p:commandButton style="margin-top: 20px;" value="#{msg['common.save']}" update="messages" icon="ui-icon-disk" actionListener="#{adminHomeController.saveFieldset()}"/&gt; &lt;/p:fieldset&gt; &lt;p:growl id="messages" showDetail="true"/&gt; &lt;/h:form&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload