Hi,

We've got a problem with relative urls to images in our pages due to jsps
and templates residing at different directory depths.

here's our directory structure

/images/blah.gif
/pages/MainTemplate.jsp
/pages/section1/Section1Page.jsp
/pages/section1/Section2Body.jsp

Our pages are structured in directories beneath pages and subdirectories
thereof. All pages are accessed via action servlet urls of varying depth
e.g:

/foo/bar/whiz.do  
/foo/bar/whiz/bang.do

So for relative urls to other resources to work we've added a base tag to
the main template.  This is where it all goes a bit wrong.  How do you now
reference images etc in MainTemplate.jsp as the base could be at any depth
so relative urls don't work.  Similarly if we wanted to pass other pages in
the template e.g /pages/leftnav.jsp etc, none of these would work.

Is there something I'm doing wrong? Is there some <html:img attribute I've
missed that will prefix the context to <img> tags?

Solutions I can think of are:
1) place all jsps in one folder or at the same folder depth
2) write a custom tag that prefixes /MyContext/ to the src
3) use MS Front Page (only joking)

On a similar note is there a 'correct' way of refering to components in a
template - relative or absolute

<template:insert template='/pages/MainTemplate.jsp'>
  <template:put name='body' content='/pages/section1/section1_body.jsp'/>
</template:insert>

or

<template:insert template='../MainTemplate.jsp'>
  <template:put name='body' content='section1_body.jsp'/>
</template:insert>

Thanks
Nathan



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

Reply via email to