aspose file tools*
The moose likes JSP and the fly likes JSP - Path for excel file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP - Path for excel file" Watch "JSP - Path for excel file" New topic
Author

JSP - Path for excel file

Anand Satchin
Greenhorn

Joined: Mar 24, 2005
Posts: 10
Hi,

I have a problem.
In a jsp file, I just need to put an link for a file path ( Which is stored in a different system from the webserver )
I have seen some of the examples in this forum,but I could not solve the issue.

Code:

<%
......
......
......
%>
<td align="left" colspan = 0><b><font color=#1E2582><a href="\\192.168.10.64\Public\PCI Stock List\stock_list.xls">
Click Here To Access The File</a></font></td>
<%
......
......
......
%>

Error:

When the jsp file is compiled and the output displayed as below,
Stock List Report Successfully, Saved in - P:\PCI Stock List\stock_list.xls
Click Here To Access The File

But when you move the mouse pointer to the link, it shows as,
http://192.168.10.2:8081/struts-blank/searchSupplyChainMMS/\\192.168.10.64\Public\PCI Stock List\stock_list.xls

and the error when you click on the link is
The requested resource (/struts-blank/searchSupplyChainMMS/%5C%5C192.168.10.64%5CPublic%5CPCI%20Stock%20List%5Cstock_list.xls)
is not available.

Question:

I know there is some silly logical error, but I could not figure it out.
Can anyone pls tell me how to solve this problem

And ( If possible )
i. I need to open that excel file in a Excel Rather in IE
ii. I also need to open in firefox

Cheers
Anand
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
Any file you want to downlaod via HTTP needs to be in a publicy accessible directory on that server. A file on a shared drive somewhere else may work if it is mapped to a web directory, but I'm not sure of that. But just any shared directory will not work - it needs to be in the web directory space.
[ December 06, 2006: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Anand Satchin
Greenhorn

Joined: Mar 24, 2005
Posts: 10
Hi Ulf Dittmer,
There must be a way to access the file on other network directory..

Anway thanks for the reply
Cheers
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

You must use a valid URL.

Remember that the browser on the client is issuing the link reference. A file path that makes sense on the server will most likely be bogus on the client.

You could either map the drive as Ulf suggested, or write a servlet that will stream the file.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Anand Satchin
Greenhorn

Joined: Mar 24, 2005
Posts: 10
I tried mapping the network... but still dont work.
Anway Thanks for reply...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
I tried mapping the network... but still dont work.

What does this mean? What is the path under which the mapped drive is accessible on the server, and what is the root path of the web directory?. Path #1 must be somewhere under path #2.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18662
    
    8

So you want to produce an href link to a file that's in a different server. Well, first of all that different server must be running a web server so that it can respond to HTTP requests for files. Second that web server must be configured so that it can serve that file to requests; you can't just point at files over there and hope that the web server understand what you mean, you have to provide the URL that the web server will understand.

And third, backslashes aren't valid characters in URLs.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP - Path for excel file