I'm using primefaces 5.1.7 with wildfly and have a Problem when multiple pictures are uploaded at the same time.
I have multiple instances of a ViewScoped bean which are created (tested using breakpoints in @PostConstruct)
xhtml:
<h:form enctype="multipart/form-data" prependId="true">
<p:fileUpload fileUploadListener="#{myBean.handleFileUpload}"
mode="advanced" auto="true" update="list"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/" multiple="true"/>
...
bean:
import javax.faces.view.ViewScoped;
@Named
@ViewScoped
public class MyBean implements Serializable {
...
public void handleFileUpload(FileUploadEvent event) {
...
}
}
This happens about 75% of the time but sometimes everything is just fine. Any idea how i can avoid those multiple instances?