• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to send the array in javacript to servlet from jsp

 
Raaja Gotluru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my jsp, I have a table with some file paths with this I have to get the file and send it to server. I am able to read the file name, size and file as binary using files of javascript. But after that I need to send those files by storing in a byte array to servlet which I am not able to that. Is there any way I can send that. My requirement is I need to upload those files to server side.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not entirely clear on what problem you're facing, but the standard approach for file upload for the server-side is http://commons.apache.org/proper/commons-fileupload/. For the client side you can use various jQuery plugins to make the experience nicer for the user.
 
Raaja Gotluru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Ulf Dittmer. Problem is I cannot use jQuey. At the same time I cannot use commons-fileupload as my request is getting read in the base class. So once the control comes to the required class I am not able to get the data from request. So when I use

items = upload.parseRequest(request);

I am getting null list.

Any way I changed the design solved that by generating dynamically one file input element for each file to upload.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jQuery was just a suggestion for making it more user-friendly; if that is not a consideration then you can just use a standard HTML form.

At the same time I cannot use commons-fileupload as my request is getting read in the base class.

What is the "base class"? You may wish to refactor it so it doesn't impede on the proper working of other parts of the application. If that's not an option, then don't route the request through that class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!