problem loading files in java jsf

0

Good afternoon somebody could help me with this topic, the truth so far I have not found good material to study, on the internet there are several videos but most of them are from jsp and I currently use jsf, I have a job loading files in where they ask me to upload these in pdf and the load is massive, but I can help thank you very much.

    
asked by MOISES PINZON XIQUES 09.05.2018 в 19:05
source

1 answer

0

Well you could use the component for JSF, which is primefaces, and its p: fileupload, with multiple option. link

<h:form>
    <p:fileUpload fileUploadListener="#{fileUploadView.handleFileUpload}" mode="advanced" dragDropSupport="false"
                  multiple="true" update="messages" sizeLimit="100000" fileLimit="3" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />

    <p:growl id="messages" showDetail="true" />
</h:form>

Y

package org.primefaces.showcase.view.file;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;

import org.primefaces.event.FileUploadEvent;
import org.primefaces.model.UploadedFile;

@ManagedBean
public class FileUploadView {

    public void handleFileUpload(FileUploadEvent event) {
        FacesMessage message = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
        FacesContext.getCurrentInstance().addMessage(null, message);
    }
}

Running PrimeFaces-6.2.10 in Mojarra-2.3.2.

Although I think it does not change much, but always check.

Thanks to J. Castro for the review, he's right about the link.

Greetings

    
answered by 08.10.2018 в 00:06