On 15/05/2012 15:08, Christopher Schultz wrote:

On 5/15/12 5:00 AM, André Warnier wrote:

Personal opinion :<Base>  tags are evil. They create all kinds of
issues when you move the app, or change your server configuration.
There shouldn't be any real reason to use them, if your app is
structured properly. Relative paths should work.

+1

I only just found out in the last few months that URIs within a CSS
are /relative to the URI of the CSS/ which blew my mind and, honestly,
makes total sense.

A JSP developer needs to know how (and when) references are resolved in at least these cases:

<%@ include file="foo" ...
<%@ include file="/foo" ...

<%@ page errorPage="foo" ...
<%@ page errorPage="/foo" ...

<%@ taglib uri="foo" ...
<%@ taglib uri="/foo" ...

<jsp:forward page="foo" ...
<jsp:forward page="/foo" ...

<jsp:include page="foo" ...
<jsp:include page="/foo" ...

<link href="foo" ...
<link href="/foo" ...

<script src="foo" ...
<script src="/foo" ...

<img src="foo" ...
<img src="/foo" ...

<style type="text/css"> p { background:url(foo) } ...
<style type="text/css"> p { background:url(/foo) } ...

[surely there are more, e.g. within in-page JavaScript?]

What *nix minds think of as an "absolute" path e.g. /foo is just relative to something other than what foo is relative to.

I'll try to find a small prize for whoever is first to provide links to clear, definitive documentation of how each case above resolves ;-)

I can't see a really good reason to use a<base>  tag these days unless
you want fully-qualified paths for all URLs and want to save on
bandwidth or something like that.

We found one, but if you are just using <base> empirically, to make things work when you don't really understand "relative paths", then it's probably worth time spent figuring out how to manage without it.

Paul Singleton

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to