Link to home
Start Free TrialLog in
Avatar of master_programmer
master_programmerFlag for Saudi Arabia

asked on

how to add variable file name to <a herf>

Hi
what i want to do is to add link to afile in my jsp page, the path of my files are constant for example
"c:\uplods" , but the file name may change , how i can concatenat the path with the file name so the user can click on the filename and the file opend
<a hert="c:\uploads"> filename </a>
ASKER CERTIFIED SOLUTION
Avatar of contactkarthi
contactkarthi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well that won't work. First you link to a local file. If the user clicks on it, the link is local for the visitor, so it would link to a file on the user-computer. Probably there is no such file. Second, this is not allowed in most browsers. You cannot link to a local file (using C:) unless the page is opened locally (with file:/// instead of http://).

What webserver do you use? Tomcat? If so you can simply create a mapping to that directory, and then use a relative path.
Avatar of master_programmer

ASKER

Yes i am using tomcat and my web site is local, what do you mean by:
 create a mapping to that directory, and then use a relative path.