Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Uploader with a progress bar in Struts2

 
fres nillo
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I want to use an file uploader with a progress bar with Struts2, which works with all internet browsers but there is a problem with that.

I had to develop an Ajax solution with a boundary to "skip" the file upload interceptor (to send data like a form.submit() ), but the solutions works only if the browser permit read the file (in IE with an ActiveXObject which calls to system file read methods, with Firefox with FileReader, in Chrome 9 in other way; but Safari, Chromium and Opera don't have support with that because it's based in File HTML5 API).

I have test develop an Flex3 & 4 solution too, but the problem is that the server has an self-signed certificated ssl connection, and Flex doesn't support this certification type.

Is there an implementation/plugin (ot is it known) that supports ssl self-signed certification with Struts2 that works in all explorers? I see that in Struts1 works with a Listener that sends to client with JSON the status data uploaded, but I didn't see nothing in Struts2 that works fine.

Thanks.
 
abhishek rathur
Ranch Hand
Posts: 66
 
fres nillo
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your quick response, but I don't have any idea how it's related with the question about a file uploader with progress status, please reply if I'm in a mistake.

I thought about using the interceptor execAndWait to send the progress like this (putting the progressBar in a iframe):
...
dojo.io.iframe.send({
url: ...upload.action,
method: 'post',
handleAs: 'json',
load: function(response){
var progress = response.percentComplete;
document.getElementById('progressBar').style.width = progress+"%";
});
...

I extracted that from http://stackoverflow.com/questions/4073140/strut2-execandwait-interceptor-json-result-type-dojo-dijit-progressbar-ajax, but I don't have any idea what is or where is the FileProcessor class (non ProcessFileAction).

Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic