• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling a jsp page from javascript

 
Abhishek Makkar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I have a javascript function that should call a jsp with parameters passed from the javascript, that jsp has a form with encType="multipart/form-data". Form has a browse button(with file input) and a upload button that will upload the file on the server.

2. From the javascript i will pass a string that will be populating the browse field of the JSP, so is it possible to get the file stream like this on the jsp?

3. After all this i will be calling the upload button of jsp, how to do it from the javascript on another page?

4. Finally return to the calling page.

Thanks
-Abhishek
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are describing a JSp as if it's a method that can be called and then return control to the original caller. HTTP doesn't work that way.

JSP is a templating mechanism for creating HTML pages to be sent to the browser. So everywhere you will be using JSP, just think of it as an HTML page and "call" it the same way that you would another HTML page.
 
Abhishek Makkar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Point taken, but there is a problem i am using a propriety web framework which only supports javascript and uploading a file is not supported so i got a upload bean from google results . So i want to use that bean from javascript either from a javascript page or a servlet.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will not be able to upload with Javascript; that requires server-side intervention. There's an entry in the JSP FAQ on file uploading.

Please post any further questions on file upload in the servlets forum as it is not a Javascript issue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic