For example, I could have someline like:
How do I conditionally invoke warn() based on the property in a bean, and if so, should I use oncomplete, which makes more sense.
Some ideas of this would be appreciated - thank you.
posted 5 years ago
Ok, I have found a partial solution to this problem that does not use onstart or oncomlete in the <p:fileUpload/> tag.
I found that with code of the type:
There are probably various ways of doing this, but I just want a simple solution. Any ideas would be most welcomed.
File uploading is done in HTTP by creating an HTTP FORM submit data stream and MIME-encoding a copy of the file's data into that stream. So the only way to avoid uploading the file is to suppress the HTTP SUBMIT.
In other words, something like this, in the form's "onsubmit" event handler:
Note also that BECAUSE the actual file data is copied, and not the file itself, the server name for the file doesn't have to be anything like the client file name. And, in fact, you don't have to store the uploaded data in a file at all. You can store it in a database blob, dissect it and use the information in it, or do anything else you want to with it. So you wouldn't literally be "replacing the file" unless you chose to put the incoming data in the same place as previous data matching that upload filename value.
An IDE is no substitute for an Intelligent Developer.
posted 5 years ago
I put this issue on the back burner for a week, and have just got back to it, and have mostly solved it with PrimeFaces, but there is still an issue.
This indeed now works. However, the problem is that the code does not resume execution after RequestContext......(), which it needs to do. The idea is that the flag overwrite is set to true, then later tested.
It looks as if this is an issue of having to deal with a callback function, so that execution can resume in the method copyFile(). Do you or anybody else know how to do this?