On Thu, 9 Aug 2001, Wang, Jianming wrote:
> Hi,
>
> Is there a way to know a resource's absolute URL? I have a image, say
> img1.gif. I want to reference it using
> http://www.something:port/appName/graphics/img1.gif in jsp page. How can I
> get all these information to create the url? I use tomcat 3.2 and it
> doesn't support ServletContext.getServletContextName(). Could you give me a
> help? Thanks in advance.
You don't want the servlet context name -- you want the context
*path*, which you can get by calling request.getContextPath(). The parts
after that come from request.getServletPath() and request.getPathInfo().
>
> Jianming Wang
>
Craig