Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Browser Support to open a file by clicking on filename

 
SaiManasa Dasari
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Here is my code to open file by clicking on filename.




Now my problem is when clicking on link to open pdf/text/image files in new window it working fine for firefox.but in IE it showing open/save dialogbox when opening file.
can anyone help me what changes need to do to open file directly in new window by clicking on filename.

Thanks..
 
SaiManasa Dasari
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i give like

its working in IE also.but documentdownload.jsp is opening again in new window.how to prevent opening new jsp again.can anyone please help me.

I tried also.its opening new blank window.without opening new blank window how to get work this?please reply me...
 
narayana Ega
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If You want to open a file then simply you can execute a command from your java program to open that file.

if you want to get the file abc.pdf opened, You can use the following command...

String command = "abc.pdf";
Process child = Runtime.getRuntime().exec(command);

Before you are using this command set the path of the file....in command line with your java program like

if the file is in "c:/My Files/abc.pdf" then
String command = "cd c:/My Files";
Process child = Runtime.getRuntime().exec(command);

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
narayana Ega wrote:If You want to open a file then simply you can execute a command from your java program to open that file.

Except that this is in a web app and Java isn't useful for doing anything on the client unless it's an Applet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic