• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1205
  • Last Modified:

how can I build a URL in JSP page ?

I need to build a link in a JSP page that looks (in effect) like this
<a href="file:///T:/Operations/IT/IT Shared/Enterprise/EDW/EDW/cdr_reports/ods_cdr_tab_cnt_035_2011_04_26_at_10_33.out">CDR Load</a>

So it's pulling up a file from the corporate file system

The destination and the link text are both data returned from Oracle.

I tried it like this and the URL is formed ok, looks like a link, but when I click it nothing happens.

      <td align="left"><a href="<c:out value="${hist.cdrReportLoc}"/>"><c:out value="${hist.procDescription}"/></a></td>

With the above command the link looks ok, it comes out as
file:///T:/Operations/IT/IT Shared/Enterprise/EDW/EDW/cdr_reports/ods_cdr_tab_cnt_035_2011_04_26_at_10_33.out

but when I do this is straight HTML, the link opens ok
<a href="file:///T:/Operations/IT/IT Shared/Enterprise/EDW/EDW/cdr_reports/ods_cdr_tab_cnt_035_2011_04_26_at_10_33.out">T drive, April 2011</a>

So something with JSP or JSTL I'm not handling correctly.
0
Alaska Cowboy
Asked:
Alaska Cowboy
  • 8
  • 5
1 Solution
 
cmalakarCommented:
I believe, as you are trying to access a file on local file system, browser wont allow that access, if the html was served from server.

Because jsp's are served from server, browser is blocking the access to files.

When you open html file from the same machine, where the file being accessed exists, then browser allows because it knows that html was accessed from the same machine, and allows access to local file system.

To get this done through jsp's, you need to send a separate request to your servlet, and download the file.
0
 
Alaska CowboyAuthor Commented:
cmalakar,

ok, thanks for the quick reply. So . . . how do I send a separate request to my servlet to download the file ? (I don't know anything about servlets, so if I have one, I wasn't aware of it . . . )
0
 
Alaska CowboyAuthor Commented:
I am having issues between browsers, I got the link to be as accurate as I can get for now. It works on IE-7 but not on FF-4.0 or Chrome 10.0
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Alaska CowboyAuthor Commented:
0
 
for_yanCommented:
One way to do it - if the file is located on your corporate file share, then you check if you can make a link in
somewhere under document root of your server which would lead you to
to the location of the file. Then you could have the path to your file
starting with http://  rather tyhan with file:// and this issue about some browsers having possible
limitaions for the file: protocol in the HTML page, downloaded from server, will go away.

0
 
Alaska CowboyAuthor Commented:
unfortunately, I cannot put the documents in the root of my server, it has to be off onto a corporate shared windows directory. Thanks.
0
 
for_yanCommented:
You don't need to put the documents there - documents can suit wehere they are;
the only thing you need is to create link to the folder or to upper folder, under which
the documents are sitting
0
 
Alaska CowboyAuthor Commented:
but the documents aren't on a web server, so how do I create the link ? I thought only the file:///... would work.
0
 
for_yanCommented:
well usually all servers on one corporate site (at least so it is on all sites in our company)
 are accessed form one another as remote network
folders. That was my assumption that location with the documents is accessible as
network folder from the web server. If that is not the case, then it complicates the situation
0
 
Alaska CowboyAuthor Commented:
it's just a file server, not a web server. I think I will have to write a servlet, if only I knew how.
0
 
for_yanCommented:
Is your file server a windows machine?
Or is ait accessible form windows?
If so, it takes just a 15 minutes to set up
a web server on windows machine (Apache)
and then you can use the http: link instead of file:
to your documents
0
 
Alaska CowboyAuthor Commented:
>>Is your file server a windows machine?
yes

but I won't be able to set up apache, this is a corporate environment and everything is locked down.
0
 
for_yanCommented:
Well, if you don't have admin privileges on any windows machine, then
you cant do it - true.
0
 
Alaska CowboyAuthor Commented:
see new question
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now