4.5. Handling Relative URLs in Web Applications
Suppose you have an image that you want displayed in a JSP page. If the image is used only by that particular JSP page, you can place the image and the JSP page in the same directory; the JSP page can then use a simple relative URL to name the image, as below:
<IMG SRC="MyImage.gif" WIDTH="..." HEIGHT="..." ALT="...">
If there are lots of different images, it is usually convenient to group them in a subdirectory. But each URL remains simple:
<IMG SRC="images/MyImage.gif"...>
So far, so good. But what if the same image is used by JSP or HTML pages that are scattered throughout your application? Copying the image lots of places would be wasteful and would make updating the image difficult. And ...
Get More Servlets and JavaServer Pages™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.