Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3


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,

Code Block
<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,

  • Context roots rarely change.
  • There are not that many files to modify,
  • All the decorator files are organized in one folder.
  • Search and replace tools are available to make this easy.