You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Craig Longman <cr...@begeek.com> on 2002/09/12 06:54:20 UTC

getting current page name from jsp tag

i'm delving into the depths of tag writing, and the first thing i need
to do was write a tag that could figure out what the name of the current
page being processed is.  the only way i could see to do this was to use
the PageContext.getRequest().getRequestURL/I() methods.  all of this is
in tomcat 4.1.10.

two questions:

1) is there another way?  i couldn't see anything in the PageContext or
Page objects that might help, any better suggestions for what the actual
page is would be appreciated.  the request uri will be satisfactory for
where i need them to be for now, but i'd rather figure out the real way
of getting the name of the file that is actually being processed.  in
fact, i guess the parent file, in case its being included in some other
fashion.

2) the PageContext.getRequest().getRequestURL/I() returns some strange
stuff.  it looks like a bug, but i'm having so much other trouble
getting things going i would like a second opinion before i track it
down/submit it.  here's what i get (the 'unable to proces URL' is the
text i log this error with):

getRequestURI():
2002-09-11 22:48:32 unable to process URL: 
<HEAD>
 <TITLE>

getRequestURL():
2002-09-12 00:51:22 URL: http://server.tomcat.begeek.com
<HEAD>
 <TITLE>

pretty strange.  (note the second one is logged differently because it
doesn't produce an erorr, although it is missing the required / on the
end, it is still parseable.  i guess the java.net.URL stops at the first
LF).

confirmations or suggestions?

-- 

    CraigL->Thx();
    Be Developer ID: 5852