RE: REPOST: Relative URLs

2005-03-30 Thread tarek.nabil
 :

Thanks Erik. I guess when you get into the tags mood, you forget there's
something called scriptlets :)

-Original Message-
From: Erik Weber [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 30, 2005 5:06 PM
To: Struts Users Mailing List
Subject: Re: REPOST: Relative URLs

How about:

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

. . .




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  and  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  tag, cause some
>>
>>
>of
>  
>
>>the images are background images.
>>
>>I thought about the  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 
>> 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]



Re: REPOST: Relative URLs

2005-03-30 Thread Erik Weber
How about:
<% String basePathVar = (String) application.getAttribute("myPathVar"); %>
. . .

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  and  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  tag, cause some
   

of
 

the images are background images.
I thought about the  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 
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]


RE: REPOST: Relative URLs

2005-03-30 Thread tarek.nabil
Hi David,

I'm afraid I don't understand your solution. I'm using Struts 1.1, but I
don't know what you mean by contextRelative="false". It doesn't seem to
be an attribute on the img or image tags. Also, I need a solution that
will work with plain old html tags as well, not just with Struts html
tags, since as I mentioned, some of the images are background images and
I can not use html:img with that.

Could you please explain further.

Thanks

-Original Message-
From: David G. Friedman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 30, 2005 3:28 AM
To: Struts Users Mailing List
Subject: RE: REPOST: Relative URLs

Dear Tarek,

Action example URL:
http://server/my-application/my-module/doSomething.do

Resulting JSP's image example UR:
http://server/my-application/images/some-image.gif

What happens when you use html:img with (depending on your version of
Struts):
a) contextRelative="false"[for 1.1 or earlier]
b) module=""[for 1.2 or newer]

Then add your src="/images/some-image.gif".  That SHOULD keep your
module relative to your webapps "/images" directory and NOT CARE what
your webapp name is or someday changes into instead of "/my-application"


For more details, skim the HTML taglib userGuide at:
http://struts.apache.org/userGuide/struts-html.html#image

Regards,
David


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



RE: REPOST: Relative URLs

2005-03-29 Thread tarek.nabil
 
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  and  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  tag, cause some
of
>the images are background images.
>
>I thought about the  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 
>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]



RE: REPOST: Relative URLs

2005-03-29 Thread David G. Friedman
Dear Tarek,

Action example URL:
http://server/my-application/my-module/doSomething.do

Resulting JSP's image example UR:
http://server/my-application/images/some-image.gif

What happens when you use html:img with (depending on your version of
Struts):
a) contextRelative="false"[for 1.1 or earlier]
b) module=""[for 1.2 or newer]

Then add your src="/images/some-image.gif".  That SHOULD keep your module
relative to your webapps "/images" directory and NOT CARE what your webapp
name is or someday changes into instead of "/my-application" 

For more details, skim the HTML taglib userGuide at:
http://struts.apache.org/userGuide/struts-html.html#image

Regards,
David


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



RE: REPOST: Relative URLs

2005-03-29 Thread Benedict, Paul C
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  and  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  tag, cause some of
>the images are background images.
>
>I thought about the  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 
>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]



Re: REPOST: Relative URLs

2005-03-29 Thread Erik Weber
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  tag, cause some of
the images are background images.
I thought about the  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 
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]