aspose file tools
The moose likes JSP and the fly likes Open word doc in folder which is not in weblogic server 10.3 context path and IE 7.0 Browser Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Open word doc in folder which is not in weblogic server 10.3 context path and IE 7.0 Browser" Watch "Open word doc in folder which is not in weblogic server 10.3 context path and IE 7.0 Browser" New topic
Author

Open word doc in folder which is not in weblogic server 10.3 context path and IE 7.0 Browser

Mushtaq Ahamad
Greenhorn

Joined: Nov 10, 2011
Posts: 1
Hi All,
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 :
HELP_FOLDER=download


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";
%>

<a href="<%=helpFileName%>">User Manual IRT Download (*.doc)</a>


web.xml :
<mime-mapping>
<extension>doc</extension>
<mime-type>application/msword</mime-type>
</mime-mapping>

Please Help

Thanks
Mushtaq


Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

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)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Open word doc in folder which is not in weblogic server 10.3 context path and IE 7.0 Browser
 
Similar Threads
web.xml causes 404 error
Mistakenly changed web.xml
MIME Types
Apache2 / Tomcat 6 / GWT 2.0 - Could use some help
Java to Display Data from Database