This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to select and open a file using jsp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to select and open a file using jsp?" Watch "How to select and open a file using jsp?" New topic
Author

How to select and open a file using jsp?

Seema Shetty
Greenhorn

Joined: Jan 23, 2001
Posts: 9
Hi,
I need the code to select a file from the specified directory by browsing for that file(html file) and to open it on the internet explorer.
Or I want to know how I can achieve this using some of the api or javascript in jsp?
Thanks in advance
Seeema
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
The thread below has the code to select the directory using JFileChooser: http://www.javaranch.com/ubb/Forum33/HTML/001305.html
Once you have the file you can either "execute" the file and let the MIME type direct what browser gets opened:
Process p = Runtime.getRuntime().exec(f); //opens with whatever application the user has specified for that extension type
or you can NAME the browser and hope that the user has the application and that it is in the path:
String runThis = "\"" + "ie.exe " + f + "\""; //create the command in quotes
Runtime.getRuntime().exec(runThis);
[This message has been edited by Cindy Glass (edited April 23, 2001).]


"JavaRanch, where the deer and the Certified play" - David O'Meara
Seema Shetty
Greenhorn

Joined: Jan 23, 2001
Posts: 9
Hi Cindy,
I tried to execute the code which is here.But it gives me application error when it tries to open the file.Why is that so?
Thanks
Seema
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Which code did you try? and can you show us your version of it?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to select and open a file using jsp?
 
Similar Threads
storing .pdf files in jsp
Selecting folder instead of File(Folder Dialog box)
input file element
Regarding Excel sheel in jsp
window.open