Getting the Page URI from Custom JSP Tag

J

John Topley

Hi,

I'm developing a custom JSP tag library. How do I get the full URI of
the page that is using the taglib?

Thanks,

John
 
S

Sudsy

John said:
Hi,

I'm developing a custom JSP tag library. How do I get the full URI of
the page that is using the taglib?

HttpUtils.getRequestURL( (HttpServletRequest) pageContext.getRequest());
 
K

kaeli

john@$NO_SPAM said:
Hi,

I'm developing a custom JSP tag library. How do I get the full URI of
the page that is using the taglib?

Depends on what you want it for. Note that JSPs are compiled into servlets,
and the container may move them to another location, so if you're looking to
load a file that's in the "same directory" or something, don't use this
method.

That said...

Servlet Class
javax.servlet.HttpServletRequest

getRequestURI() Gets the URI to the current JSP page.

--
 
S

Sudsy

Sudsy said:
HttpUtils.getRequestURL( (HttpServletRequest) pageContext.getRequest());

Oops! Javadocs say that's a StringBuffer so add .toString() to the end.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top