Why is the getContextPath() method only available from the
HttpServletRequest object? Isn't this defined at the time
the servlet is initialized? It would be convenient
to have this value available from the HttpServlet object
without referencing the request object.
For example, I'm using the path for creating url href's to static html pages.
I can't use relative url's because it uses the actual servlet url
as the base.
That url can be just a logical hierarchy defined
within a servlet-mapping tag.
For example:
Using:
<servlet-mapping url-pattern='my/weird/path/MyServlet' servlet-name='MyServlet'/>
<servlet>
<servlet-name>
MyServlet
</servlet-name>
<servlet-class>
myPackage.MyServlet
</servlet-class>
</servlet>
If I use:
"../myHtml/MyStaticPage.html"
in my servlet to create a link, the url created is:
"my/weird/myHtml/MyStaticPage.html,
even though that page is really stored as:
/Web-inf/myHtml/MyStaticPage.html.
So it doesn't get found.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html