Fileupload does not load the Listener into JSF 2.2

Asked

Viewed 193 times

2

I am migrating a project to JEE7 from Primefaces 3.5 to 5.0 and I have a problem with Fileupload. Does not load the file into the JSF 2.2 Event Manager.

Follow the xhtml code:

<p:fileUpload id="import" value="#{fileBean.file}" mode="single" 
    label="#{msg.procurar}" 
    auto="true" fileUploadListener="#{fileBean.handleFileUpload}"
    invalidFileMessage="#{msg.somente_excel}"
    allowTypes="/(\.|\/)(xls|xlsx)$/" />

Follow the bean:

public void handleFileUpload(FileUploadEvent event) throws IOException {
      this.uploadedFile = event.getFile();
}

Does anyone have any idea why the event is not being triggered? JSF2.2 has changed some configuration or property ?

  • What comes in the method parameter?

  • 1

    I put an exit to the console in enent.getFie() ma showed nothing as it is not firing the event.

1 answer

3

From what I understand here, you have to withdraw the value, since the value will be treated by the Listener.

Besides, the mode is wrong, you put single, but the right thing is simple

Browser other questions tagged

You are not signed in. Login or sign up in order to post.