Introduction

All JEE applications use a context root which is basically the parent directory.

As discussed in the SiteMesh tutorial, working with SiteMesh the full context root path should be used for decorator files and JSP 2.0 now includes support for EL (Expression Language) which allows dynamic generation of the context root.

However, if JSP 2.0 is not available here are some other alternatives.

Scriplets to Generate Context Path

JSP scriplets, the original means of dealing with context roots,

<img src="<%=request.getContextPath() %>/decorators/logo.jpg" alt="logo" />

Use Search and Replace

Use the full path and do a search and replace if the context root changes.

Really, this is actually a viable solution when,