• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calling a jsp page from javascript

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic