Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

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!
0
pdanese
Asked:
pdanese
  • 5
  • 3
  • 2
  • +1
1 Solution
 
zzynxSoftware engineerCommented:
>> 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
0
 
zzynxSoftware engineerCommented:
They don't need to be doubled
0
 
pdaneseAuthor Commented:
??
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
CEHJCommented:
myPathString = myPathString.replaceAll("\\\\", "\\\\\\\\");
0
 
zzynxSoftware engineerCommented:
>> ??
/Rpfs01/Department/Finance/Public/Requisitions 4000+/req 4005 Sigma.xls
0
 
pdaneseAuthor Commented:
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')">

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

DP
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now