I have a form with many input fields plus a "primary" component for uploading several files "p: fileUpload", when I submit the form, I can not get the downloaded files .. manged bean - "RequestScoped". So, how can I load downloaded files without creating a marked bean view area?
loading method
public void upload(FileUploadEvent event) { try { FacesMessage msg = new FacesMessage("Success! ", event.getFile().getFileName() + " is uploaded."); FacesContext.getCurrentInstance().addMessage(null, msg);
component
<p:fileUpload label="#{TalentMessages.lbl_Select_File}" fileUploadListener="#{talentPropertyAction.upload}" mode="advanced" multiple="true" uploadLabel="#{TalentMessages.lbl_upload_File}" cancelLabel="#{TalentMessages.lbl_cancel_File}" sizeLimit="2000000" oncomplete="completeUploadFile(#{talentPropertyAction.talentId});" />
then save function
@Setter @Getter private List<SystemFile> systemFiles; try { // save something else then save the files if (systemFiles != null) { System.out.println("Not Null" + systemFiles); for (SystemFile systemFile : systemFiles) { TalentPropertyFile talentPropertyFile = new TalentPropertyFile(); talentPropertyFile.setTalentProperty(talentProperty); talentPropertyFile.setFile(systemFile); getTalentService().save(getActor().getAccount(), talentPropertyFile); } } else { System.out.println("Null"); } } catch (InvalidParameter ex) { SystemLogger.getLogger(getClass().getName()).error(null, ex); }
source share