You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Johnson <ch...@gmail.com> on 2005/05/11 17:57:25 UTC

question

Hey all

I've got the followiong directory structure for my web-app

C:\Builds\riskGrid\WebRoot\jsp (all JSP's are here)
C:\Builds\riskGrid\WebRoot\jsp\images (all images)

This is the image code (in a JSP in the jsp directory) that results in the 
image not being found. What am I missing?? I cant have an absolute URL for 
obvious reasons.

(note everything else is working, the link, the submit, etc.)

<html-el:img src="../jsp/images/portGraph.gif" 
onclick="set('portfolioGraph');javascript:setPortName('${
refPortfolio.refPortfolioDesc}');document.forms[0].submit();"/>

-- 
-Dave
ChaChaNY@Gmail.com

Re: question

Posted by David Johnson <ch...@gmail.com>.
another tidbit, the following link displays the gif file properly

http://localhost:8080/myApp/jsp/images/portGraph.gif


On 5/11/05, David Johnson <ch...@gmail.com> wrote:
> 
> The full img tag includes some el tags which werent coming out properly 
> with a normal img tag :( I tried that first :)
> 
> the URL when this page is up is : 
> http://localhost:8080/myApp/portfolio.action but the base href is:
> 
> <base href="http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp
> ">
> 
> 
> 
> <html-el:img src="../jsp/images/portGraph .gif" 
> onclick="set('portfolioGraph');javascript:setPortName('${
> refPortfolio.refPortfolioDesc}');document.forms[0].submit();"/>
> 
> how can I embed the above el stuff in a notmal img tag, and also within a 
> JS call?
>  
> 
> On 5/11/05, Wendy Smoak <ja...@wendysmoak.com> wrote:
> > 
> > From: "David Johnson" <ch...@gmail.com>
> > > Any thoughts on this? I tried
> > > <html-el:img src="../../jsp/images/portGraph.gif"
> > > but that is an illegal argument :( 
> > 
> > What is the URL in the browser window when it's trying to load the 
> > image?
> > Images are requested separately by the browser after the page is loaded.
> > The URL for the image needs to be relative to the "page" the browser 
> > thinks 
> > it loaded, not the location of the JSP files.
> > 
> > BTW, it looks like a plain old HTML <img src="..."> tag would work fine
> > here, why suffer the overhead of a taglib when there is no dynamic 
> > content? 
> > 
> > --
> > Wendy Smoak
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> > 
> 
> 
> -- 
> -Dave
> ChaChaNY@Gmail.com 




-- 
-Dave
ChaChaNY@Gmail.com

Re: question

Posted by David Johnson <ch...@gmail.com>.
<img src="<c:url value='/jsp/images/portGraph.gif'/>" 
onclick="set('portfolioGraph');javascript:setPortID('<c:out value="${
refPortfolio.refPortfolioID}"/>');javascript:setPortName('<c:out value="${
refPortfolio.refPortfolioDesc}"/>');document.forms[0].submit();"/>&nbsp;

works like a charm.

so no more html-el:img for me.

On 5/11/05, Wendy Smoak <ja...@wendysmoak.com> wrote:
> 
> From: "David Johnson" <ch...@gmail.com>
> > the URL when this page is up is :
> > http://localhost:8080/myApp/portfolio.action but the base href is:
> > <base href="http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp">
> 
> FWIW, I never use <base>. Or at least I would set it to something
> reasonable like the index page of the site.
> 
> Given that URL, without the base tag, it seems to me the proper URL would
> just be "jsp/images/portGraph.gif".
> 
> > <html-el:img src="../jsp/images/portGraph .gif"
> > onclick="set('portfolioGraph');javascript:setPortName('${
> > refPortfolio.refPortfolioDesc}');document.forms[0].submit();"/>
> 
> Is this copied and pasted? You have a space in the image filename...
> 
> > how can I embed the above el stuff in a notmal img tag, and also within 
> a
> JS
> > call?
> 
> You can use <c:out> to get the dynamic part into whatever HTML you want.
> (I'd also move that mess of JavaScript into a function and pass it 
> whatever
> argument it needs.) But... it shouldn't be relevant-- whether you use 
> plain
> old HTML or let Struts generate for you, it's still just HTML by the time 
> it
> gets to the browser, and the browser should be able to load the image.
> 
> Check that possible typo, and let us know how it goes!
> 
> --
> Wendy Smoak
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
-Dave
ChaChaNY@Gmail.com

Re: question

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "David Johnson" <ch...@gmail.com>
> the URL when this page is up is :
> http://localhost:8080/myApp/portfolio.action but the base href is:
> <base href="http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp">

FWIW, I never use <base>.  Or at least I would set it to something
reasonable like the index page of the site.

Given that URL, without the base tag, it seems to me the proper URL would
just be "jsp/images/portGraph.gif".

> <html-el:img src="../jsp/images/portGraph .gif"
> onclick="set('portfolioGraph');javascript:setPortName('${
> refPortfolio.refPortfolioDesc}');document.forms[0].submit();"/>

Is this copied and pasted?  You have a space in the image filename...

> how can I embed the above el stuff in a notmal img tag, and also within a
JS
> call?

You can use <c:out> to get the dynamic part into whatever HTML you want.
(I'd also move that mess of JavaScript into a function and pass it whatever
argument it needs.)  But... it shouldn't be relevant-- whether you use plain
old HTML or let Struts generate for you, it's still just HTML by the time it
gets to the browser, and the browser should be able to load the image.

Check that possible typo, and let us know how it goes!

-- 
Wendy Smoak



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


Re: question

Posted by David Johnson <ch...@gmail.com>.
The full img tag includes some el tags which werent coming out properly with 
a normal img tag :( I tried that first :)

the URL when this page is up is : 
http://localhost:8080/myApp/portfolio.action but the base href is:

<base href="http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp">



<html-el:img src="../jsp/images/portGraph .gif" 
onclick="set('portfolioGraph');javascript:setPortName('${
refPortfolio.refPortfolioDesc}');document.forms[0].submit();"/>

how can I embed the above el stuff in a notmal img tag, and also within a JS 
call?
 

On 5/11/05, Wendy Smoak <ja...@wendysmoak.com> wrote:
> 
> From: "David Johnson" <ch...@gmail.com>
> > Any thoughts on this? I tried
> > <html-el:img src="../../jsp/images/portGraph.gif"
> > but that is an illegal argument :(
> 
> What is the URL in the browser window when it's trying to load the image?
> Images are requested separately by the browser after the page is loaded.
> The URL for the image needs to be relative to the "page" the browser 
> thinks
> it loaded, not the location of the JSP files.
> 
> BTW, it looks like a plain old HTML <img src="..."> tag would work fine
> here, why suffer the overhead of a taglib when there is no dynamic 
> content?
> 
> --
> Wendy Smoak
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
-Dave
ChaChaNY@Gmail.com

Re: question

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "David Johnson" <ch...@gmail.com>
> Any thoughts on this? I tried
>  <html-el:img src="../../jsp/images/portGraph.gif"
> but that is an illegal argument :(

What is the URL in the browser window when it's trying to load the image?
Images are requested separately by the browser after the page is loaded.
The URL for the image needs to be relative to the "page" the browser thinks
it loaded, not the location of the JSP files.

BTW, it looks like a plain old HTML <img src="..."> tag would work fine
here, why suffer the overhead of a taglib when there is no dynamic content?

-- 
Wendy Smoak


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


Re: question

Posted by David Johnson <ch...@gmail.com>.
Any thoughts on this? I tried

 <html-el:img src="../../jsp/images/portGraph.gif"

but that is an illegal argument :(

On 5/11/05, David Johnson <ch...@gmail.com> wrote:
> 
> Interesting twist, when I add in <html:base/> it gets translated into 
> this:
> 
> <base href="http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp"<http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp%22>
> >
> 
> So, does that mean the base location is the "layouts" dir? Obviously I'm 
> using Tiles in this app.
> 
> Thoughts?
> 
> On 5/11/05, David Johnson <ch...@gmail.com> wrote:
> > 
> > Hey all
> > 
> > I've got the followiong directory structure for my web-app
> > 
> > C:\Builds\riskGrid\WebRoot\jsp (all JSP's are here)
> > C:\Builds\riskGrid\WebRoot\jsp\images (all images)
> > 
> > This is the image code (in a JSP in the jsp directory) that results in 
> > the image not being found. What am I missing?? I cant have an absolute URL 
> > for obvious reasons.
> > 
> > (note everything else is working, the link, the submit, etc.)
> > 
> > <html-el:img src="../jsp/images/portGraph.gif" 
> > onclick="set('portfolioGraph');javascript:setPortName('${
> > refPortfolio.refPortfolioDesc}');document.forms[0].submit();"/>
> > 
> > -- 
> > -Dave
> > ChaChaNY@Gmail.com 
> 
> 
> 
> 
> -- 
> -Dave
> ChaChaNY@Gmail.com 




-- 
-Dave
ChaChaNY@Gmail.com

Re: question

Posted by David Johnson <ch...@gmail.com>.
Interesting twist, when I add in <html:base/> it gets translated into this:

<base href="http://localhost:8080/myApp/jsp/layouts/siteLayout.jsp">

So, does that mean the base location is the "layouts" dir? Obviously I'm 
using Tiles in this app.

Thoughts?

On 5/11/05, David Johnson <ch...@gmail.com> wrote:
> 
> Hey all
> 
> I've got the followiong directory structure for my web-app
> 
> C:\Builds\riskGrid\WebRoot\jsp (all JSP's are here)
> C:\Builds\riskGrid\WebRoot\jsp\images (all images)
> 
> This is the image code (in a JSP in the jsp directory) that results in the 
> image not being found. What am I missing?? I cant have an absolute URL for 
> obvious reasons.
> 
> (note everything else is working, the link, the submit, etc.)
> 
> <html-el:img src="../jsp/images/portGraph.gif" 
> onclick="set('portfolioGraph');javascript:setPortName('${
> refPortfolio.refPortfolioDesc}');document.forms[0].submit();"/>
> 
> -- 
> -Dave
> ChaChaNY@Gmail.com 




-- 
-Dave
ChaChaNY@Gmail.com