I've run into a very basic problem using Clay that I'm not sure how to solve.

Here's the setup:

I have a JSP file (we'll call it page.jsp) that contains a single <clay> tag 
that points to an HTML template in a subdirectory (we'll call it 
/templates/blah/foo.html).  The HTML template references an image file in a 
completely different directory (/images/bar.jpg).

How do I get the image to display properly both when rendered by Clay and when 
just loaded as a mockup?

When loaded through the JSP using Clay, the image file's relative path is 
images/bar.jpg.  However, when the HTML is loaded directly with a browser 
either online or offline, the image file's relative path is instead 
../../images/bar.jpg.

Using the absolute path (/appName/images/bar.jpg) works for both forms of 
online viewing (via JSP and as mockup), but it doesn't work for offline viewing 
(since the absolute path then becomes 
/full/filesystem/path/to/appName/images/bar.jpg), and I'd also rather not 
hard-code my application's context root into my HTML.

I thought of using a <base> tag with jsfid="void", but that doesn't work, since 
<base> only accepts full URL's and not relative paths.

Does anyone know of a way around this?  

Incidentally, the same issue arises with links to stylesheets.
 

Rich Eggert
Member of Technical Staff
Proteus Technologies, LLC
http://www.proteus-technologies.com

Reply via email to