Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8692675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:21:48+00:00 2026-06-13T00:21:48+00:00

I have form with many input fields plus primefaces component to upload multiple file

  • 0

I have form with many input fields plus primefaces component to upload multiple file “p:fileUpload” when I submit the form I can’t get the uploaded files .. the manged bean is “RequestScoped” . So how can I get the uploaded files without making the manged bean View scope?

the upload method

    public void upload(FileUploadEvent event) {
    try {
        FacesMessage msg = new FacesMessage("Success! ", event.getFile().getFileName() + " is uploaded.");
        FacesContext.getCurrentInstance().addMessage(null, msg);
        // Do what you want with the file
        String thumbnail = getDestination() + event.getFile().getFileName();
        int index = thumbnail.lastIndexOf('.');
        SystemFile systemFile = new SystemFile();
        systemFile.setAccount(getActor().getAccount());
        systemFile.setName(event.getFile().getFileName());
        systemFile.setPath(getTalentPath());

        systemFile.setFileType(FileUtil.checkFileType(thumbnail.substring(index + 1)));
        if (systemFiles == null) {
            systemFiles = new ArrayList<>();
        }
        systemFiles.add(systemFile);
        copyFile(event.getFile().getFileName(), event.getFile().getInputstream());
    } catch (IOException ex) {
        SystemLogger.getLogger(getClass().getSimpleName()).error(null, ex);
    }
}

primefaces 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 the 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);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:21:49+00:00Added an answer on June 13, 2026 at 12:21 am

    So how can I get the uploaded files without making the manged bean View scope?

    Just store the upload information immediately in a more permanent place than as a property of a request scoped bean which get garbaged by end of request-response anyway (note: every upload counts as a separate HTTP request).

    public void upload(FileUploadEvent event) {
        // Now, store on disk or in DB immediately. Do not assign to a property.
    }
    
    public void save() {
        // Later, during submitting the form, just access them from there.
    }
    

    If you need some key to access them, consider storing the key in the session scope.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with many input fields. When I catch the submit form
I have a form that asks users to input numbers into multiple form fields.
I have a form with many input fields on it, some with validation. I
I have a struts form that contains many input fields generated using indexed properties.
I have a form with multiple text input fields and sub-forms. Is there a
i have a form that has many input fields. some fields of them are
I have many input fields in a form to post data to server side.
suppose i have form and it has many form fields. how can i iterate
I have form containing many input fields. But I need to take one field
Possible Duplicate: Obtain form input fields using jQuery? I have a form with many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.