You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Doug Ahmann <da...@macromedia.com> on 2000/08/07 21:32:58 UTC

Getting name of jsp file from within the jsp page

What is the quick and dirty way of getting the name of the jsp page from
within the jsp page?

For instance, inside "login.jsp" I would like to determine if I'm within
"login.jsp".

FWIW, I'm trying to create a toolbar that automatically highlights the
"current" page. If there is a better way, other than hard-wiring it into the
page, let me know.

Thanks,
Doug

---------------------------------------------------
Doug Ahmann
Macromedia, Inc.
(612) 840-9544


Re: Getting name of jsp file from within the jsp page

Posted by ALEXANDROS KOTSIRAS <AL...@prodigy.net>.
Maybe the request.getRequestURI() or request.getServletPath() can do that.
They will give you the entire path relative to the Context but you can
extract the filename only:

request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/"))

..or a similar expression...
I might be wrong , i haven't tried that.
Alex.


----- Original Message -----
From: Doug Ahmann <da...@macromedia.com>
To: <to...@jakarta.apache.org>
Sent: Monday, August 07, 2000 3:32 PM
Subject: Getting name of jsp file from within the jsp page


> What is the quick and dirty way of getting the name of the jsp page from
> within the jsp page?
>
> For instance, inside "login.jsp" I would like to determine if I'm within
> "login.jsp".
>
> FWIW, I'm trying to create a toolbar that automatically highlights the
> "current" page. If there is a better way, other than hard-wiring it into
the
> page, let me know.
>
> Thanks,
> Doug
>
> ---------------------------------------------------
> Doug Ahmann
> Macromedia, Inc.
> (612) 840-9544
>