View Full Version : hyperlink is not working on giving dynamic link value

02-13-2009, 06:40 AM
I am inserting files in database manually using sql query,the file name are in the form.'C:/Documents and Settings/Administrator/Desktop/check.js'.there is a list of files.now in front end in javascript I wrote:
"<table><tr><td><b>Attachments: </b></td><td><a href='"+link+"'> click here</a></td></tr>";here in the link the value 'C:/Documents and Settings/Administrator/Desktop/check.js' is coming.I have checked it using alert.
But when I am clicking on the link nothing happens,no error comes.and when I right click the link the same file which is in giving specified location is getting saved....I tried many options but all in vain.
Can somebody help me.I am totally confused what to do now????

02-13-2009, 07:03 AM

file:///C:/Documents and Settings/Administrator/Desktop/check.js

02-13-2009, 07:59 AM
Thanks for your quick reply... :)
It shows the location file:///C:/Documents and Settings/Administrator/Desktop/check.js
when I put mouse over the link....but does nothing,only when I click on save as target it is getting saved ,I am getting the file values from java,is there any need to use encodeURL to encode the link value.
in java:
pointer = rs_attachment.getString("Pointer");
String pointer1 = URLEncoder.encode(pointer);
now I am accessing this pointer1 in js using :
in link the pointer1 is coming:
"<tr><td></td><td><a href='"+link+"'> here</a></td></tr>";
the thing is here that I can't give a specific value because there are many files I have to access.Is there any solution????

02-13-2009, 04:20 PM
So clicking on the link does nothing? It should try to download automatically in most browsers. Also are you using Java or Javascript? They are two entirely different languages.

02-16-2009, 05:17 AM
yes clicking on link does nothing....neither it shows any error.I am using javascript as front end.and in back end to get the values of attachment files I am using java.I am still stucked with the problem.

02-16-2009, 10:23 AM
I am working in protlet context so is the problem is occuring that I am accessing the localfiles from browser because when I am making a simple html program to open it,it is easily opened.Is the problem due to switching the context??and if it is so then what can be the solution???