You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joao Batistella <jo...@ptinovacao.pt> on 2004/03/15 20:05:23 UTC

Context relative URL

Hello!

I have the following HTML img tag:
<html:img page="/images/inicial.gif" border="0"
          onmouseover="this.src='/images/inicio-over.gif'"
          onmousedown="this.src='/images/inicio-down.gif'"
          onmouseout="this.src='/images/inicio.gif'"/>

The problem is that the page attribute is ok, img tag add the app context
before de page attribute and the image appears. But the others images in the
javascript events dosn't appear because struts doesn't put the app context
before the address.
I got the following HTML:

<img src="/myapp/images/inicio.gif" border="0" 
	onmouseover="this.src='/images/inicio-over.gif'" 
	onmouseout="this.src='/images/inicio.gif'" 
	onmousedown="this.src='/images/inicio-down.gif'">

How can I have this generated with all the images with myapp before the
source of the image? Like this:
<img src="/myapp/images/inicio.gif" border="0" 
	onmouseover="this.src='/myapp/images/inicio-over.gif'" 
	onmouseout="this.src='/myapp/images/inicio.gif'" 
	onmousedown="this.src='/myapp/images/inicio-down.gif'">

Thanks,
JP

Re: Context relative URL

Posted by Geeta Ramani <ge...@cmpco.com>.
Hi JP:

I believe you can use <html:rewrite for this. As in:

onmouseover="this.src='<html:rewrite page="/images/inicio-over.gif" />' "
etc.

Hope this helps,
Geeta

Joao Batistella wrote:

> Hello!
>
>
> How can I have this generated with all the images with myapp before the
> source of the image? Like this:
> <img src="/myapp/images/inicio.gif" border="0"
>         onmouseover="this.src='/myapp/images/inicio-over.gif'"
>         onmouseout="this.src='/myapp/images/inicio.gif'"
>         onmousedown="this.src='/myapp/images/inicio-down.gif'">
>
> Thanks,
> JP


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Context relative URL

Posted by Mark Lowe <ma...@talk21.com>.
looks like a basic javascript question to me but here goes anyway.

Stop trying to put everything in the event

context = "<c:url value="/" />";
imgdir = context + "/images/";

//perhaps create an array to preload.
images = ["inico"];

function mover(name) {
	document.images[name].src = imgdir + name +"-over.gif";
}

function mout(name) {
	document.images[name].src =  imgdir + name +".gif";
}

<html:link page="/foo.do" linkName="inicio"
		onmouseover="mover('inicio')"
		onmouseout="mout('inicio')" ..



On 16 Mar 2004, at 08:00, subramaniam.o@tcs.com wrote:

>
> Try using <html:rewrite page='/images/inicial.gif'/>
>
>  Subramaniam Olaganthan
>  Tata Consultancy Services
>  Mailto: subramaniam.o@tcs.com
>  Website: http://www.tcs.com
>
>
>
>
> Joao Batistella <jo...@ptinovacao.pt>
>
> 03/16/2004 12:35 AM
>
>
> Please respond to
>  "Struts Users Mailing List" <st...@jakarta.apache.org>
>
>
>
> To
> 'Struts Users Mailing List' <st...@jakarta.apache.org>
>
> cc
>
> Subject
> Context relative URL
>
>
>
>
>
>
>
> Hello!
>
>  I have the following HTML img tag:
>  <html:img page="/images/inicial.gif" border="0"
>           onmouseover="this.src='/images/inicio-over.gif'"
>           onmousedown="this.src='/images/inicio-down.gif'"
>           onmouseout="this.src='/images/inicio.gif'"/>
>
>  The problem is that the page attribute is ok, img tag add the app  
> context
>  before de page attribute and the image appears. But the others images  
> in the
>  javascript events dosn't appear because struts doesn't put the app  
> context
>  before the address.
>  I got the following HTML:
>
>  <img src="/myapp/images/inicio.gif" border="0"
>                  onmouseover="this.src='/images/inicio-over.gif'"
>                  onmouseout="this.src='/images/inicio.gif'"
>                  onmousedown="this.src='/images/inicio-down.gif'">
>
>  How can I have this generated with all the images with myapp before  
> the
>  source of the image? Like this:
>  <img src="/myapp/images/inicio.gif" border="0"
>                  onmouseover="this.src='/myapp/images/inicio-over.gif'"
>                  onmouseout="this.src='/myapp/images/inicio.gif'"
>                   
> onmousedown="this.src='/myapp/images/inicio-down.gif'">
>
>  Thanks,
>  JP
>
> ForwardSourceID:NT00006182    
> <InterScan_Disclaimer.txt>--------------------------------------------- 
> ------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Context relative URL

Posted by su...@tcs.com.
Try using <html:rewrite page='/images/inicial.gif'/>

Subramaniam Olaganthan
Tata Consultancy Services
Mailto: subramaniam.o@tcs.com
Website: http://www.tcs.com



Joao Batistella <jo...@ptinovacao.pt> 
03/16/2004 12:35 AM

Please respond to
"Struts Users Mailing List" <st...@jakarta.apache.org>


To
'Struts Users Mailing List' <st...@jakarta.apache.org>
cc

Subject
Context relative URL






Hello!

I have the following HTML img tag:
<html:img page="/images/inicial.gif" border="0"
          onmouseover="this.src='/images/inicio-over.gif'"
          onmousedown="this.src='/images/inicio-down.gif'"
          onmouseout="this.src='/images/inicio.gif'"/>

The problem is that the page attribute is ok, img tag add the app context
before de page attribute and the image appears. But the others images in 
the
javascript events dosn't appear because struts doesn't put the app context
before the address.
I got the following HTML:

<img src="/myapp/images/inicio.gif" border="0" 
                 onmouseover="this.src='/images/inicio-over.gif'" 
                 onmouseout="this.src='/images/inicio.gif'" 
                 onmousedown="this.src='/images/inicio-down.gif'">

How can I have this generated with all the images with myapp before the
source of the image? Like this:
<img src="/myapp/images/inicio.gif" border="0" 
                 onmouseover="this.src='/myapp/images/inicio-over.gif'" 
                 onmouseout="this.src='/myapp/images/inicio.gif'" 
                 onmousedown="this.src='/myapp/images/inicio-down.gif'">

Thanks,
JP

ForwardSourceID:NT00006182