after putting the PrimeFaces jar file in my WEB-INF\lib folder in Eclipse, together with two other jars necessary for uploading, and adding the neccesary code to the web.xml file.
What I want to do is display on the screen a list of files that have been uploaded, together with a message for each file indicating whether it has been successfuly uploaded or not, but I do not know how to get the screen to automatically refreshed on each file upload, and have added a button to do this manually, which is not very satisfactory.
The xhtml code is as follows:
The idea is that you click the choose button generated by PrimeFaces, then select a file to upload, then upload it. This part works correctly, but what I want is the list displayed to be updated, first with the first file uploaded, followed by the second, and so on, and in each case a message is displayed to the right of that file. However, at the moment I have to click the Refresh button which fires an action event that does this.
On specifying the number of files you want to upload then clicking the "Update" button, a table is displayed with the first columns as "File 1", "File 2", "File 3", etc., to the right of that is a blank column, and to the right the characters "XXXX" are currently displayed as a place holder. On each file upload the file name is placed in the middle column, and "XXXX" is replaced by an appropriate message.
The code needs to be tidied up and some changes have to be made anyway, but in the first instance I would like to know how to update this table directly on each file upload, without having to fire an action event using the "Refresh" button, which I want to remove. The ArrayList holding boolean values will eventually be used to keep track of those files that have been successfuly uploaded, for which the user need take no further action.
I would be most grateful for some advice on this.
posted 5 years ago
Shortly after posting this I found a solution. You give a name to the update attribute in the <p:fileUpload> tag which references the id of the <p:dataTable> tag. In my case I used update="fileTable", then id="fileTable" in the dataTable tag, and it works.