Reply To: Command not fired with multipart form (JSF 2.2)

Splash Forums PrettyFaces Users Command not fired with multipart form (JSF 2.2) Reply To: Command not fired with multipart form (JSF 2.2)


Gianluca Elmo


I have just tested my application again and it works as expected.

For your information I am running Wildfly 8.2.0, PF 5.1.9, Rewrite 2.0.12 and some more other things, which I do not believe are of any relevance for you.

To test it I have uploaded a zip file into the /tmp directory and unpacked it and a .jpf file.

Here the uploadManager (sorry for the not so nicely written code)

* Manage the upload of a zip file into a fixed directory.
* @param event – the event related to the upload of the file.
public void fileUploadManager(FileUploadEvent event) {
try {
File targetFolder = new File(“/tmp/FileUpload”);
InputStream inputStream = event.getFile().getInputstream();
OutputStream out = new FileOutputStream(new File(targetFolder, event.getFile().getFileName()));
int read = 0;
byte[] bytes = new byte[1024];

while ((read = != -1) {
out.write(bytes, 0, read);

FacesMessage msg = new FacesMessage(“Succesful”, event.getFile().getFileName() + ” is uploaded.”);
FacesContext.getCurrentInstance().addMessage(null, msg);

// Unzip the file
unzip(“/tmp/FileUpload/” + event.getFile().getFileName(), “/tmp/FileUpload”);
//ief.loadDataFromFile(targetFolder.getPath(), event.getFile().getFileName());
} catch (IOException e) {

Here the client side
<p:outputLabel value=”Manuals upload” for=”manualsUploadFULst”/>
<p:fileUpload id=”manualsUploadFULst” fileUploadListener=”#{ditProSBean.fileUploadManager}” mode=”advanced” auto=”false”
allowTypes=”/(\.|\/)(zip|png|jpg)$/” multiple=”true”
cancelLabel=”#{msgs.cancel}” uploadLabel=”#{msgs.upload}” label=”#{msgs.choose}”/>

I have noticed that in your code you are using filters and servlet multipart I do not have in my web.xml

<filter-name>OCPsoft Rewrite Filter</filter-name>
<filter-name>OCPsoft Rewrite Filter</filter-name>

<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>


Hope it can help you somehow.

  • This reply was modified 6 years, 12 months ago by  Gianluca Elmo.