Alaska Cowboy
asked on
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:/Operation s/IT/IT Shared/Enterprise/EDW/EDW/ cdr_report s/ods_cdr_ tab_cnt_03 5_2011_04_ 26_at_10_3 3.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:o ut value="${hist.procDescript ion}"/></a ></td>
With the above command the link looks ok, it comes out as
file:///T:/Operations/IT/I T Shared/Enterprise/EDW/EDW/ cdr_report s/ods_cdr_ tab_cnt_03 5_2011_04_ 26_at_10_3 3.out
but when I do this is straight HTML, the link opens ok
<a href="file:///T:/Operation s/IT/IT Shared/Enterprise/EDW/EDW/ cdr_report s/ods_cdr_ tab_cnt_03 5_2011_04_ 26_at_10_3 3.out">T drive, April 2011</a>
So something with JSP or JSTL I'm not handling correctly.
<a href="file:///T:/Operation
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
With the above command the link looks ok, it comes out as
file:///T:/Operations/IT/I
but when I do this is straight HTML, the link opens ok
<a href="file:///T:/Operation
So something with JSP or JSTL I'm not handling correctly.
ASKER
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 . . . )
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 . . . )
ASKER
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
unfortunately, I cannot put the documents in the root of my server, it has to be off onto a corporate shared windows directory. Thanks.
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
the only thing you need is to create link to the folder or to upper folder, under which
the documents are sitting
ASKER
but the documents aren't on a web server, so how do I create the link ? I thought only the file:///... would work.
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
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
ASKER
it's just a file server, not a web server. I think I will have to write a servlet, if only I knew how.
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
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
ASKER
>>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.
yes
but I won't be able to set up apache, this is a corporate environment and everything is locked down.
Well, if you don't have admin privileges on any windows machine, then
you cant do it - true.
you cant do it - true.
ASKER
see new question
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.