Find the filename of the current, active JSP

Posted on 2005-04-22
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
    LVL 29

    Expert Comment


    Author Comment

    bloodredsun that will give me the page, jsp or servlet but with some path information as 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

     String servPath = request.getServletPath() ;
     String[] servPathTokens = servPath.split("/") ;
     out.println(servPathTokens[servPathTokens.length-1]) ;

    Author Comment

    Excellent! Thank you very much!
    LVL 29

    Expert Comment

    No probs, glad to help :-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Suggested Solutions

    After several days of searching and hunting for limited documentation, I wanted to share this guide to hopefully save someone the hassle of trying to figure this out on their own. I have tested this on Xendesktop 7.1 and PS 4.5 running simultaneous…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now