Link to home
Start Free TrialLog in
Avatar of pdanese
pdanese

asked on

specifying a hyperlink to a network path via java/jsp

Hi, I’m using Tomcat 5.5/Java 5.0. and Windows 2000 and Internet Explorer 6

I have a network path specified in a MySQL database table (e.g. \\Rpfs01\Department\Finance\Public\Requisitions 4000+\req 4005 Sigma.xls)

I’d like to query this database table and display the results in an HTML table with the above path to be used as a hyperlink (i.e. the user clicks on the hyperlink and up pops a 2nd page containing the xls file specified by the path).

the problem is that web-page is viewing the path as containing escape characters.  (i.e. if I click on the link as specified above, I get a file not found error.  But if I add extra backslashes directly to the html code, the link works fine [e.g. \\\\Rpfs01\\Department\\Finance\\Public\\Requisitions 4000+\\req 4005 Sigma.xls]).

Is there a way to have java automatically add the required back-slashes to make this work?  I tried replaceAll (i.e. myPathString.replaceAll(“\\”, “\\\\”) ) but this is giving me a PatternSyntaxException.

Any suggestions on how to fix?

Thanks!
Avatar of zzynx
zzynx
Flag of Belgium image

>> I have a network path specified in a MySQL database table (e.g. \\Rpfs01\Department\Finance\Public\Requisitions 4000+\req 4005 Sigma.xls)
Better work with forward slashes
They don't need to be doubled
Avatar of pdanese
pdanese

ASKER

??
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland 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
>> ??
/Rpfs01/Department/Finance/Public/Requisitions 4000+/req 4005 Sigma.xls
Avatar of pdanese

ASKER

this doens't work:  <a href="javascript:popUp('\\Rpfs01\Department\Finance\Public\Requisitions 4000+\req 4005 Sigma.xls')">

this does: <a href="javascript:popUp('\\\\Rpfs01\\Department\\Finance\\Public\\Requisitions 4000+\\req 4005 Sigma.xls')">

Did you try forward slashes btw?
Converting the one to the other is like CEHJ posted
I thiks this does too:
    <a href="javascript:popUp('/Rpfs01/Department/Finance/Public/Requisitions 4000+/req 4005 Sigma.xls')">
:-)
hi,
did you try this  myPathString.replaceAll(“\”, “\\”) ??

DP