?
Solved

specifying a hyperlink to a network path via java/jsp

Posted on 2005-03-09
11
Medium Priority
?
395 Views
Last Modified: 2010-03-31
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
Comment
Question by:pdanese
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 13498018
>> 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
 
LVL 37

Expert Comment

by:zzynx
ID: 13498024
They don't need to be doubled
0
 

Author Comment

by:pdanese
ID: 13498040
??
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 86

Accepted Solution

by:
CEHJ earned 200 total points
ID: 13498098
myPathString = myPathString.replaceAll("\\\\", "\\\\\\\\");
0
 
LVL 37

Expert Comment

by:zzynx
ID: 13498119
>> ??
/Rpfs01/Department/Finance/Public/Requisitions 4000+/req 4005 Sigma.xls
0
 

Author Comment

by:pdanese
ID: 13498151
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 13498161
Did you try forward slashes btw?
0
 
LVL 37

Expert Comment

by:zzynx
ID: 13498162
Converting the one to the other is like CEHJ posted
0
 
LVL 37

Expert Comment

by:zzynx
ID: 13498177
I thiks this does too:
    <a href="javascript:popUp('/Rpfs01/Department/Finance/Public/Requisitions 4000+/req 4005 Sigma.xls')">
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13498200
:-)
0
 
LVL 6

Expert Comment

by:durgaprasad_j
ID: 13498204
hi,
did you try this  myPathString.replaceAll(“\”, “\\”) ??

DP
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month12 days, 18 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question