• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 401
  • Last Modified:

request.getRequestURI()

request.getRequestURI() i get this:  /mypath/subpath/mypage.jsp

got any method to get /mypath/subpath/ only?
0
aaaaaa
Asked:
aaaaaa
  • 2
  • 2
3 Solutions
 
suprapto45Commented:
Hi,

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

Regards
Dave
0
 
suprapto45Commented:
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
 
koppchaCommented:
request.getContextPath()
0
 
arun99907Commented:
try using

request.getRequestURI("./../");
0
 
koppchaCommented:
My solution will work.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

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