How about:

<% String basePathVar = (String) application.getAttribute("myPathVar"); %>

. . .

<img src="<%= basePathVar %>/restOfPath/image.jpg">


Erik


tarek.nabil wrote:


Thanks everyone. I really like the idea of using a ServletContext attribute, but I'm not using the EL, is there a way I can do that without using the EL?


-----Original Message-----
From: Benedict, Paul C [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 29, 2005 6:26 PM
To: 'Struts Users Mailing List'
Subject: RE: REPOST: Relative URLs


Erik,

The problem may be that you are using JSP Tags, which are commonly
written to only output links to resources within your context. You may
want to simply think of writing plain old <a> and <img> tags and do it
yourself.

-----Original Message-----
From: Erik Weber [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 29, 2005 9:18 AM
To: Struts Users Mailing List
Subject: Re: REPOST: Relative URLs


Can't you embed a ServletContext attribute (variable) in your links using the EL? The attribute value could come from an init param and get set at app startup.


Erik


tarek.nabil wrote:



Hi everyone,

I still can not find an answer to my question, so I thought I'd repost
this and try to make it clearer. I really apreciate any help.


How can I refer to resources that are outside my module in a way that
will not mandate rewriting all the URLs in case I change the location


of


my module in the hierarchy?

My URL would look like
http://server/my-application/my-module/doSomething.do

And inside the JSP I need to refer to an image inside a folder


"images",


for example, the absolute URL should be

http://server/my-application/images/some-image.gif

For that purpose, I can not always use the <html:img> tag, cause some


of


the images are background images.

I thought about the <html:rewrite> tag, but

I can not use the page attribute, cause it's only limited to resources
inside the module.

I can not use the href attribute, because I do not want to hardcode the
application name.

I can not use the forward attribute because I do not want to specify a
forward for every image.

Even for the images that are simple images and I can use the <html:img>
tag, I can not use the pageKey attribute, also because it's module
relative and also because then I would need to all the images in the
ApplicationResources.properties file.

Thanks,
Tarek Nabil

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







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






------------------------------------------------------------------------ ------ Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. ------------------------------------------------------------------------ ------

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





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



Reply via email to