File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Calling a jsp page  from javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Calling a jsp page  from javascript" Watch "Calling a jsp page  from javascript" New topic
Author

Calling a jsp page from javascript

Abhishek Makkar
Greenhorn

Joined: Aug 11, 2006
Posts: 22
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


I know nothing except the fact of my ignorance. -Socrates
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61769
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Abhishek Makkar
Greenhorn

Joined: Aug 11, 2006
Posts: 22
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

Joined: Jan 10, 2002
Posts: 61769
    
  67

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling a jsp page from javascript