[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

request.getRequestURI()

Posted on 2005-05-04
8
Medium Priority
?
394 Views
Last Modified: 2012-05-05
request.getRequestURI() i get this:  /mypath/subpath/mypage.jsp

got any method to get /mypath/subpath/ only?
0
Comment
Question by:aaaaaa
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:suprapto45
ID: 13924513
Hi,

One possible solution is to find the last "/" and remove the rest of the string.

Regards
Dave
0
 
LVL 16

Accepted Solution

by:
suprapto45 earned 172 total points
ID: 13924528
Hi,

          String a = "/mypath/subpath/mypage.jsp";
          String newA = "";
          if (a.lastIndexOf("/") > 0)
          {
                  newA = a.substring(0, a.lastIndexOf("/") + 1);
                  System.out.println(newA);
          }

Regards
Dave
0
 
LVL 8

Assisted Solution

by:koppcha
koppcha earned 164 total points
ID: 13926821
request.getContextPath()
0
 
LVL 3

Assisted Solution

by:arun99907
arun99907 earned 164 total points
ID: 13969100
try using

request.getRequestURI("./../");
0
 
LVL 8

Expert Comment

by:koppcha
ID: 15341800
My solution will work.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Most folks would know the basics of how Dropbox works, so that’s not the purpose of this article. Security is what it’s all about, so here I’ll share how I choose to secure my Dropbox Account and the Data it contains.
Last month Marc Laliberte, WatchGuard’s Senior Threat Analyst, contributed reviewed the three major email authentication anti-phishing technology standards: SPF, DKIM, and DMARC. Learn more in part 2 of the series originally posted in Cyber Defense …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

873 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