This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I am developing jsp page which has hyperlink and on click on it should open word doc and code is deployed on sun os. when i click on hyperlink it says page can not displayed.
I am reading path using properties file :
my code on jsp is as follows:
String helpFileName = System.getProperty("user.dir") + java.io.File.separator +
com.att.irt.util.AppConfig.getProperties("HELP_FOLDER") + java.io.File.separator
+ "User Manual for IRT Tool.doc";
You're generating something like "href=C:\dir\name.doc", aren't you? And then when the user clicks on that link, that's when the error occurs? Was that what you meant to say?
You can't do that. The browser assumes that "C:\dir\name.doc" is a file on the client machine -- which of course it isn't. So you can't access the file that way. (And if it was possible to access any file on your server with a simple link like that, you would have a horrible security problem.)
So don't do that. Write a file download servlet instead. (Google keywords: file download servlet)