struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: AJAX file upload
Date Wed, 01 Dec 2010 15:20:19 GMT
On 12/1/2010 9:00 AM, Robert Graf-Waczenski wrote:
> Am 30.11.2010 21:59, schrieb Harsh C:
>> How can I setup a AJAX-ified file upload page using Struts 2? If 
>> there is
>> some integration with Dojo, it would be even better i.e. not use the OS
>> specific file upload button etc.
> There are various resources floating around in the net regarding "AJAX 
> file upload". Strictly speaking, there is no such thing as an "ajax 
> file upload" to begin with. If your web app needs to upload a file, 
> there are two choices: Either you use <input type="file"> in all its 
> ugliness (or beauty, if you put effort into styling the control 
> properly), or you implement a (signed) Java applet to grab the file 
> from your client's disk and upload it to the server.
> That being said, i would still suggest to google for "AJAX file 
> upload" because some of the resources that you can find are actually 
> quite useful and describe a solution to the problem that your web app 
> may have here and there, namely that you have an html form on your 
> page already and that you now need an extra form (on a popup dialog, 
> layer, whatever) that can be submitted while the original form is 
> *not* (or not yet) submitted. For this, ajax comes into the picture: 
> It allows you to handle a separate HTTP submit roundtrip to accept the 
> uploaded file, do some validation with it and show the appropriate 
> errors on your popup dialog when the rest of the other form has not 
> yet been submitted.
> And, finally: All this has nothing to do with Struts specifically.
> Robert

FYI, DWR v3 has a super-sweet implementation of an "AJAX upload".  
Doesn't solve the look-and-feel "issue" WRT the button, but if you want 
to really be fooled into thinking you're actually using AJAX to do an 
upload (because Robert is 100% right that there isn't actually such a 
thing) than DWR v3 will make you smile as you write the 2-3 lines of 
code you need :)

Frank W. Zammetti
Author of "Practical Palm Pre webOS Projects"
   and "Practical Ext JS Projects with Gears"
   and "Practical Dojo Projects"
   and "Practical DWR 2 Projects"
   and "Practical JavaScript, DOM Scripting and Ajax Projects"
   and "Practical Ajax Projects with Java Technology"
   (For info:
All you could possibly want is here:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message