You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Harsh C <hc...@gmail.com> on 2010/11/30 21:59:05 UTC

AJAX file upload

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.

-- 
*Thanks,
Harsh*

Re: AJAX file upload

Posted by Alex Rodriguez Lopez <al...@flordeutopia.pt>.
Still off-topic, but recently I've been using this neat feature in GMail 
where one simply grabs an actual file from, say, your desktop, and drop 
it into a designated zone in the page when composing mail. The file 
starts uploading when droped, so I guess you could call this "ajax 
upload". I wonder how they do it, but this shouldn't be too difficult to 
find out. It works with chorme and firefox, windows and os x.

Alex

Frank W. Zammetti, 01-12-2010 15:20:
> 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 :)
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AJAX file upload

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
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: apress.com/book/search?searchterm=zammetti&act=search)
All you could possibly want is here: zammetti.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AJAX file upload

Posted by Robert Graf-Waczenski <rg...@lsoft.com>.
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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: AJAX file upload

Posted by Tommy Pham <to...@gmail.com>.
 > -----Original Message-----
> From: Brian Thompson [mailto:elephantium@gmail.com]
> Sent: Tuesday, November 30, 2010 6:05 PM
> To: Struts Users Mailing List
> Subject: Re: AJAX file upload
> 
> I was assuming that he wanted his own custom look and feel for the upload
> button rather than just putting an unstyled HTML <input type="file"> on the
> page.
> 
> -Brian
> 

Then shouldn't look depends on CSS and feel (animation, effects, etc.) depends on JS/AJAX? Both of which is more dependent upon the client's browser than the OS since each browser implement CSS and JS version differently.

Regards,
Tommy

> On Tue, Nov 30, 2010 at 7:57 PM, Tommy Pham <to...@gmail.com>
> wrote:
> 
> > > -----Original Message-----
> > > From: Harsh C [mailto:hchaudh1@gmail.com]
> > > Sent: Tuesday, November 30, 2010 12:59 PM
> > > To: Struts Users Mailing List
> > > Subject: AJAX file upload
> > >
> > > 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.
> > >
> > > --
> > > *Thanks,
> > > Harsh*
> >
> > Just curious about your thoughts and question, since when is the web
> > ever OS specific?  Also, IIRC, I don't recall Java - 'develop
> > anywhere, deploy anywhere' - ever being OS specific.  That said, how
> > can Struts (dependent upon Java) ever being OS specific?
> >
> > Regards,
> > Tommy
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AJAX file upload

Posted by Brian Thompson <el...@gmail.com>.
I was assuming that he wanted his own custom look and feel for the upload
button rather than just putting an unstyled HTML <input type="file"> on the
page.

-Brian

On Tue, Nov 30, 2010 at 7:57 PM, Tommy Pham <to...@gmail.com> wrote:

> > -----Original Message-----
> > From: Harsh C [mailto:hchaudh1@gmail.com]
> > Sent: Tuesday, November 30, 2010 12:59 PM
> > To: Struts Users Mailing List
> > Subject: AJAX file upload
> >
> > 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.
> >
> > --
> > *Thanks,
> > Harsh*
>
> Just curious about your thoughts and question, since when is the web ever
> OS
> specific?  Also, IIRC, I don't recall Java - 'develop anywhere, deploy
> anywhere' - ever being OS specific.  That said, how can Struts (dependent
> upon Java) ever being OS specific?
>
> Regards,
> Tommy
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: AJAX file upload

Posted by Tommy Pham <to...@gmail.com>.
> -----Original Message-----
> From: Harsh C [mailto:hchaudh1@gmail.com]
> Sent: Tuesday, November 30, 2010 12:59 PM
> To: Struts Users Mailing List
> Subject: AJAX file upload
> 
> 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.
> 
> --
> *Thanks,
> Harsh*

Just curious about your thoughts and question, since when is the web ever OS
specific?  Also, IIRC, I don't recall Java - 'develop anywhere, deploy
anywhere' - ever being OS specific.  That said, how can Struts (dependent
upon Java) ever being OS specific?

Regards,
Tommy


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AJAX file upload

Posted by piyush kumar <al...@gmail.com>.
thanks dave!!

On Wed, Dec 1, 2010 at 7:09 PM, Dave Newton <da...@gmail.com> wrote:

> On Wed, Dec 1, 2010 at 8:33 AM, piyush kumar <alivelove2003@gmail.com
> >wrote:
>
> > Yeah you are right, dojo is there in struts2, but that is all i know :-(
> >
>
> ...
>
> In any case, it's deprecated, and uses an ancient version of Dojo. Don't
> use
> it.
>
> Dave
>

Re: AJAX file upload

Posted by Dave Newton <da...@gmail.com>.
On Wed, Dec 1, 2010 at 8:52 AM, Peter Nguyen wrote:

> This seems to be a recurring piece of advice with regards to the use of the
> struts 2 dojo plugin.  Out of curiosity, is there any reason why the plugin
> is still included in the latest releases?
>

Yes, because it's deprecated, not removed. People still use it, but after
being marked "deprecated" they do so at their own risk.

Dave

RE: AJAX file upload

Posted by Peter Nguyen <pe...@peternguyen.id.au>.
Dave, 

This seems to be a recurring piece of advice with regards to the use of the
struts 2 dojo plugin.  Out of curiosity, is there any reason why the plugin
is still included in the latest releases?

Peter.

-----Original Message-----
From: Dave Newton [mailto:davelnewton@gmail.com] 
Sent: Thursday, 2 December 2010 12:39 AM
To: Struts Users Mailing List
Subject: Re: AJAX file upload

On Wed, Dec 1, 2010 at 8:33 AM, piyush kumar <al...@gmail.com>wrote:

> Yeah you are right, dojo is there in struts2, but that is all i know 
> :-(
>

...

In any case, it's deprecated, and uses an ancient version of Dojo. Don't use
it.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: AJAX file upload

Posted by Dave Newton <da...@gmail.com>.
On Wed, Dec 1, 2010 at 8:33 AM, piyush kumar <al...@gmail.com>wrote:

> Yeah you are right, dojo is there in struts2, but that is all i know :-(
>

...

In any case, it's deprecated, and uses an ancient version of Dojo. Don't use
it.

Dave

Re: AJAX file upload

Posted by piyush kumar <al...@gmail.com>.
Yeah you are right, dojo is there in struts2, but that is all i know :-(

On Wed, Dec 1, 2010 at 2:29 AM, Harsh C <hc...@gmail.com> wrote:

> 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.
>
> --
> *Thanks,
> Harsh*
>