[Logo] OLD FORUM - Use new one: https://www.CaptainCasa.online/forum
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Automated Fileupload while changing Pages  XML
Forum Index -> Development
Author Message
cfuchs

Active

Joined: 21/01/2013 09:33:01
Messages: 16
Offline

Hey,

I have developed my own client components which extend the regulary asynchronious upload and download functionality.

While there is not any problem when I remain on the same page (using onUebernehmen Event), the upload does not work when I change the Page (onOK Event).

Is there a way to solve this matter?

Pseudocode
Code:
 public void onOK (ActionEvent event) {
   startUpload();
   goToLastSite();
 }
 
 public void onUebernehmen (ActionEvent event) {
   startUpload();
 }
 
 private void startUpload() {
    // Application processing
    uploadTrigger.trigger();
 }
 


My upload component looks like the FILEUPLOADASYNCHRONOUSElement with a few extensions.

Thanks in advance.
Admin

Power User

Joined: 21/11/2007 11:36:10
Messages: 38
Offline

Hmm,

what type of upload components are using? Which one is the one you internally use by your own component?

What does "upload does not work" mean exactly?

Regards!
Björn
cfuchs

Active

Joined: 21/01/2013 09:33:01
Messages: 16
Offline

Hi,

internally I am using the internal class FileUploader with the method startUploadFiles in order to upload multiple files.

By defining a parameter the component knows which files to upload without user interaction.

What I mean with "it does not work" - when I press the button for onUebernehmen, I get the upload dialog telling me the amount of files and the number of kilobytes which have been transfered until it is finished. Afterwards the upload finish method is called.
When I use the button for onOK event, it changes the page and I don't receive any upload dialog. The upload finish method is not called either.

I assume that the client loses the client component context as the page (jsp site) is changed and thus the invoke later event to start the upload fails.

Hope this information helps.


Regards,

Christian
cfuchs

Active

Joined: 21/01/2013 09:33:01
Messages: 16
Offline

After debugging the Java Log, I have found out that my components are destroyed because I changed the pages (or rather beans associated with another jsp).

Thus, my question reduces to "Is it possible to have an client interaction which is executed before the server calls the client to tell him that the current bean has been changed?

cfuchs

Active

Joined: 21/01/2013 09:33:01
Messages: 16
Offline

Okay, I have found a solution for the problem.

Actually, it is quite simple - I have only moved the page changing functionality into the callback method. Only at that point, it is clear that the client component has been fully executed and that the page can be changed.

Only thing one has to pay attention to is that in case of an error within the client component, the server must be still called in order to execute the callback method. Otherwise, the page won't changed.
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team