get file name

Posted on 2006-04-17
Last Modified: 2010-04-01
I have a jsp file . How can I get file's name by code ?
Question by:tunhien
    LVL 23

    Expert Comment

    can you be clear
    you want the same JSP's name in that JSP????
    or you want that JSP name in some other java class.?

    Author Comment

    you want the same JSP's name in that JSP????  <---- yes
    LVL 23

    Expert Comment

    <%String x = request.getRequestURI();

    use <%=x%> where ever you want to display.

    just try this and get back.
    LVL 23

    Accepted Solution

    <%String x = request.getRequestURI();
    x = x.substring(x.lastIndexOf("/"),x.length());%>

    sorry use this code instead.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    Synchronize a new Active Directory domain with an existing Office 365 tenant
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    754 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

    18 Experts available now in Live!

    Get 1:1 Help Now