Find the filename of the current, active JSP

Posted on 2005-04-22
Medium Priority
Last Modified: 2008-03-17
Is there a name to get the name of the current JSP? I'm asking if there is a similar method like PHP's $_SERVER['PHP_SELF'] which will return the filename of the current php page.
Question by:varkon
  • 3
  • 2
LVL 29

Expert Comment

ID: 13840926

Author Comment

ID: 13841256
bloodredsun that will give me the page, jsp or servlet but with some path information as well...is there a way (by using a method or some sort of manipulation) to get that without any slashes, dots or path info in general?
LVL 29

Accepted Solution

bloodredsun earned 400 total points
ID: 13841309
 String servPath = request.getServletPath() ;
 String[] servPathTokens = servPath.split("/") ;
 out.println(servPathTokens[servPathTokens.length-1]) ;

Author Comment

ID: 13841612
Excellent! Thank you very much!
LVL 29

Expert Comment

ID: 13841621
No probs, glad to help :-)

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I came across an unsolved Outlook issue and here is my solution.
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 …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 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