aspose file tools*
The moose likes JSF and the fly likes How to implement 'Please Wait !!!' screen while doing file upload - JSF 1.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to implement Watch "How to implement New topic
Author

How to implement 'Please Wait !!!' screen while doing file upload - JSF 1.2

kc pradeep
Greenhorn

Joined: Mar 05, 2011
Posts: 28

I am trying to implement a file upload functionality. One of the requirement is to display a 'Please Wait!!!' message to the user while the upload is going on. My project currently uses JSF 1.2, Tomahawk, JQuery 1.9, JQuery UI 1.10. I am aware that this can be accomplished using a4j with richfaces, however I am not supposed to add any new library to the existing project. Please let me know how this can be done?


OCPJP 6
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

Just so you know, Tomahawk and RichFaces can peacefully co-exist in a single webapp. RichFaces pulls in a copy of jQuery, but if you need a newer version of jQuery, that's also doable. So there's no technical reason why you couldn't use the RichFaces file upload (in fact, I had a webapp that did!). At least with RichFaces 3. The transition to RF 4 is so painful I have yet to find resources to migrate, so I can't confirm.

The bigger issue is that "Please wait" doesn't apply to basic HTTP, because the file upload isn't an independent operation from the Submit processing. When you do an HTML file upload (which is what JSF generates), the contents of the file in question are MIME-encoded into the form that's POSTed to the server. So the file upload is "complete" at the very moment that the last byte of the form posting is received by the server. Not counting the time it takes the server to parse the form, spool the file into its receiving storage (RAM or disk), and for the application logic to do something with it - all of which should be taking no more than a second or 3.

The RichFaces file upload gets its progress indicator by using AJAX to manage the file upload. Probably by splitting the upload into smaller chunks, but I haven't checked to be certain. Since RichFaces uses jQuery to do its AJAX processing, there's a good possibility that there's a raw jQuery equivalent, but you'll have to dig through the jQuery universe to find it, since I've never tried it myself so I don't know anything for certain.


Customer surveys are for companies who didn't pay proper attention to begin with.
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2615
    
    9

Well what you want is similar to disabling the screen (dim it) when the file uploads or the server is processing the page. I did this dimming effect in one of my projects using CSS. No javascript or JSF (primefaces for me) is needed.

The idea is when the user clicks the submit button, it triggers the CSS div to dim the screen.

Hope this helps.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to implement 'Please Wait !!!' screen while doing file upload - JSF 1.2