One of the most important things to know when creating Servlets is that the
browser doesn't know (or care) what created the HTML or if it is static or
dynamic. It could be static, generated by a CGI, generated by a Servlet,
etc. The browser only knows the URL that the file came from (and header
information). All relative paths work exactly the same as if you had a
static file at the same URL.

I prefer to always use URLs relative to the root ('/'). You can also use the
"<base href='http://www.domain.com/documents/'>" tag to make all relative
URLs that don't start with '/' relative to where ever you want instead of
the current URL.

Aaron

> -----Original Message-----
> From: Ackerman, Lee [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 10, 1999 9:50 AM
> To: [EMAIL PROTECTED]
> Subject: Accessing Static html files and images
>
>
> I'm hoping that there is a simple answer to the following:
>
> I need to be able to have my servlet generate a dynamic HTML file that
> references static elements such as a javascript file and an
> image.  Is there
> a way to use relative paths to specify where to retrieve
> these items?  Or do
> I have to write a servlet that handles the request of the
> static files?  I
> have the Servlet book by Jason Hunter and he has a sample
> servlet that can
> be used for the retieval of static files - do I have to use
> something like
> this in order to have this mix of dynamic and static html?
>
>
> Thanks for you help!
>
> Lee Ackerman
> (403)264-0955
>
> ______________________________________________________________
> _____________
> 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
>

___________________________________________________________________________
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

Reply via email to