Using the <html:base/> tag is powerful, though, as it allows you to use relative (to page) references for links/images/etc. - if needed, and module relative references are still supported by <html:img .../>, <html:rewrite .../>, and of course, <html:link ...></html:link> tags. That's how our application is structured - this way, when we put things in different directories, and each of those directories has its own images directory, so we can use the same tile or JSP in each of those directories and have them use relative image paths, when necessary (specific to the hierarchy they're in), and *also* use module relative paths by using the other Struts tags.

Makes code re-use in HTML a lot more attractive :)

Brice

Holman, Cal wrote:

Ruth>> I don't think so. They were thinking of this option. The HTML:BASE renders a <base/> tag reference relative to the page request. So if your template is in the app root then the effect is the same. I use templates that are actually in different directories so in order to ensure all relative references are to the root I use the scriplet. Not sure this is a best practice. But I do not need to worry what jsp I am coding on - all references are relative to the root. This simplifies the html and if I reorganize the site there are no links/img changes necessary. It does make IDE rendering harder since they typically do best with relative urls and no base tag.

Cal

http://www.calandva.com/ Last update 08/01/03


-----Original Message----- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Saturday, October 25, 2003 18:59 To: Struts Users Mailing List Subject: Re: Tiles And Images

Just an FYI (and correct me if I'm wrong), but just doing <html:base/>
will pretty much do what all the stuff you have below there does - what
you have in there is the default behavior of the Struts-HTML base tag.

Holman, Cal wrote:



Try searching the archives this is a common issue. The requests for images are based on where the template tiles is using is located - not the location of the jsp being inserted in the template. One approach is to use the base tag - I do the following to ensure all images and links are rooted at the same level in the application - the root. This is the simplest, but there are other suggestions as well.

This line is in the base template - or any template.
<base href="http://<%= request.getServerName()%>:<%= 
request.getServerPort()%><%=request.getContextPath()%>/">

Images then are referenced from the root of the web app - this is from the footer jsp

<img src="web/images/footer/struts-power.gif" width="95" height="37" border="0" alt="struts"/>

My directory structure is

App
--> web (web stuff)
-->WEB-INF

Others like the WEB-INF capability to protect resources.

Cal

http://www.calandva.com/ Last update 08/01/03

-----Original Message-----
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Friday, October 24, 2003 14:42
To: [EMAIL PROTECTED]
Subject: Tiles And Images

I use tiles and stylesheet to display my web pages.  I
also try to insert some images in those pages.

The tiles work fine.  I have header, footer, navbar,
content, etc. displayed without problem.  But, I am
curious to know if anybody has had difficulties in
inserting images.  I have tried various ways and
cannot succeed.

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Learn more about Paymentech's payment processing services at www.paymentech.com THIS MESSAGE IS CONFIDENTIAL. This e-mail message and any attachments are proprietary and confidential information intended only for the use of the recipient(s) named above. If you are not the intended recipient, you may not print, distribute, or copy this message or any attachments. If you have received this communication in error, please notify the sender by return e-mail and delete this message and any attachments from your computer.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Learn more about Paymentech's payment processing services at www.paymentech.com
THIS MESSAGE IS CONFIDENTIAL. This e-mail message and any attachments are proprietary and confidential information intended only for the use of the recipient(s) named above. If you are not the intended recipient, you may not print, distribute, or copy this message or any attachments. If you have received this communication in error, please notify the sender by return e-mail and delete this message and any attachments from your computer.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to