specifying a hyperlink to a network path via java/jsp
Posted on 2005-03-09
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?