First of all, you'd put <html:base> somewhere between <head> and </head>. Tha makes the current JSP the point of reference for all URLS on the page. Then, if the current page is in /myapp/pages, just specify:
The two below solutions are heuristic and helpful. Just provide another common way for url, store all urls (no matter whether they belong to one app/context) to a property file or database, then it will NOT impact any existing code but only change property file or database if some relative/full paths are changed.
Joined: Feb 08, 2006
To clarify the usage of the base tag...that sets a base url/directory that the browser should will for all subsequent calls. You would then have to use a relative path to your image. Something like this src="../images/btnAdd.gif". Though, I agree that the usage of the page attribute is cleaner.