You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Robert Bowen <sy...@yahoo.com> on 2006/05/17 12:34:46 UTC

Runtime expressions with

Is this possible? According to the docs it is. But when I try the following:

<c:set var="path" value="/images/splash.jpg" scope="page" />

<img:image src="${path}"/>

The page fails saying File Not Found: '${path}'. Meaning it's not interpreting the path variable, but rather just spitting it back out as plain text. Yes, I have the core jstl libraries working properly, since the following statement:

path is <c:out value="${path}" />

prints out "path is /images/splash.jpg"

Any ideas?

Many thanks!
BOb
		
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.

Re: Runtime expressions with

Posted by Martin Cooper <ma...@apache.org>.
On 5/17/06, Robert Bowen <sy...@yahoo.com> wrote:
>
> Well how do you like that. Perhaps I should have mentioned I am a JSTL
> newbie, but I guess you already got that.
>
> No, "path = ${path} does not work. I am using JSTL 1.0 and Servlet 2.4.
>
> So can I do this? ...Without changing versions of JSTL / Servlet?


<img:image src='<c:out value="${path}"/>' />

--
Martin Cooper


Thanks buckets,
> Bob
>
> Hassan Schroeder <ha...@webtuitive.com> wrote: Robert Bowen wrote:
> > Is this possible? According to the docs it is. But when I try the
> following:
> >
> >
> >
> >
> >
> > The page fails saying File Not Found: '${path}'. Meaning it's not
> > interpreting the path variable, but rather just spitting it back
> > out as plain text. Yes, I have the core jstl libraries working
> > properly, since the following statement:
> >
> > path is
>
> is meaningless :-)  -- does
>
>   path is ${path}
>
> work? If not, you're not using JSTL 1.1 and/or Servlet 2.4, where
> the *container* interprets/expands EL statements.
>
> A more precise answer would be possible with actual information
> about your configuration...
>
> HTH!
> --
> Hassan Schroeder ----------------------------- hassan@webtuitive.com
> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
>                 opinion: webtuitive.blogspot.com
>
>                           dream.  code.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------
> How low will we go? Check out Yahoo! Messenger's low  PC-to-Phone call
> rates.
>

Re: Runtime expressions with

Posted by Kris Schneider <kr...@dotech.com>.
Hassan Schroeder wrote:
> Robert Bowen wrote:
> 
> 
>>No, "path = ${path} does not work. I am using JSTL 1.0 and Servlet 2.4.
>>
>>So can I do this? ...Without changing versions of JSTL / Servlet?
> 
> 
> short answer: no. Though I'm not sure where that <img:... tag comes
> from, haven't used it myself.

Well, "no" is maybe too short an answer. At worst you should be able to do 
something like:

<img:image src='<%= (String)pageContext.getAttribute("path") %>'/>

> But if you're using a 2.4 deployment descriptor -- check what's at
> the beginning of your application's web.xml -- upgrading to JSTL 1.1
> is as simple as downloading and replacing a couple of jar files...
> 
> And well worth it, IMO -- replacing all those `<c:out value="${path}"/>`
> statements with `${path}` cleans up a workspace most wonderfully :-)

Agreed. If you can upgrade, it's a good idea for a number of reasons.

> FWIW!

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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


Re: Runtime expressions with

Posted by Robert Bowen <sy...@yahoo.com>.
Hmm ... well, I guess I downloaded the wrong library. Anyway, I was wrong in my last email, using a java scriptlet I got it to work.

But I don't think I am going to be able to use it. Since I am generating images on the fly in a loop, so that the image tag doesn't generate the image once and then spit that same image out x number of times I have to give each image NAME a unique name. No problem, I just use the loop counter. But if I don't put refresh=true, it still only generates one image, and spits it out for every iteration of the loop. I don't get this behaviour really ... assuming each name is unique, even though refresh=false it should generate a unique image for each iteration the first time the page is accessed and then just load them from the disk for all future page accesses. But that's not the case.

Anyway, if I leave refesh=true it seems to work but it takes a looooong time to generate the images (in the docs it recommends against setting refresh=true) and that's with only 2 images on the page! When I have 20, fugetaboudit!

So I decided to stick a little code in my app that saves a reduced version of the image and spit that version out as a thumbnail in the page, and to show the larger version when they click on the thumbmail.

Anyway, I want to thank everyone for the posts. I am going to have to try using the latest JSTL library from Apache and see if I can't get the JSTL tags to work with nested JSTL runtime expressions, since sticking scriptlets in there is a) ugly and b) kind of defeats the purpose of using tags in the first place!

Thanks again!
Bob

Hassan Schroeder <ha...@webtuitive.com> wrote: Robert Bowen wrote:
> The image tag I am referring to,  is NOT HTML but rather the Jakarta taglib as the last poster mentioned.
> 
> Neither this: 

Just out of curiousity, I downloaded the nightly of the image
taglib (and dependencies) and tried it; the following JSP page:
----------------------------------------------------------------

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/image-1.0" prefix="img" %>


${imageSource} 



-----------------------------------------------------------------
:: works exactly as expected, printing the value of 'imageSource'
and displaying that image...

> I downloaded jstl 1.1 (the jar that comes with Java SDK 1.4, appserv-jstl.jar, right?) 

No idea what that is; I'm using the Apache/Jakarta implementation:
   

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
                opinion: webtuitive.blogspot.com
    
                          dream.  code.



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



		
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1&cent;/min.

Re: Runtime expressions with

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Robert Bowen wrote:
> The image tag I am referring to, <img:image> is NOT HTML but rather the Jakarta taglib as the last poster mentioned.
> 
> Neither this: 

Just out of curiousity, I downloaded the nightly of the image
taglib (and dependencies) and tried it; the following JSP page:
----------------------------------------------------------------

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/image-1.0" prefix="img" %>

<c:set var="imageSource" value="/lib/images/button.png"/>
${imageSource} <br/>
<img:image src="${imageSource}" name="minibutton.png"/>

-----------------------------------------------------------------
:: works exactly as expected, printing the value of 'imageSource'
and displaying that image...

> I downloaded jstl 1.1 (the jar that comes with Java SDK 1.4, appserv-jstl.jar, right?) 

No idea what that is; I'm using the Apache/Jakarta implementation:
   <http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html>

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
                opinion: webtuitive.blogspot.com
				
                          dream.  code.



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


Re: Runtime expressions with

Posted by Robert Bowen <sy...@yahoo.com>.
The image tag I am referring to, <img:image> is NOT HTML but rather the Jakarta taglib as the last poster mentioned.

Neither this: 

<img:image src='${path}' />

nor this: 

<img:image src='<c:out value="${path}"/>' />

not this: 

<img:image src='<%= (String)pageContext.getAttribute("path") %>'/>

works. If I put ${path} alone it doesn't process it. If I put either of the other 2 it says the <img> tag is missing its right-hand component.

I downloaded jstl 1.1 (the jar that comes with Java SDK 1.4, appserv-jstl.jar, right?) and got rid of my old jstl.jar and standard.jar and ${path} all by itself, without <c:out> still doesn't work.

In my web.xml I changed the first line from :

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

to:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
            http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">

and my  tomcat/common/lib/servlet-api.jar is verison 2.4. And it's still not working.

*Sigh*

Thanks for all your help guys ...
Bob

Kris Schneider <kr...@dotech.com> wrote: Martin Cooper wrote:
> On 5/17/06, Hassan Schroeder  wrote:
> 
>>
>> Robert Bowen wrote:
>>
>> > No, "path = ${path} does not work. I am using JSTL 1.0 and Servlet 2.4.
>> >
>> > So can I do this? ...Without changing versions of JSTL / Servlet?
>>
>> short answer: no. Though I'm not sure where that 
>> from, haven't used it myself.
> 
> 
> 
> Uh, that would be HTML...

;-) I had a WTF moment when I read your previous reply because I assumed it 
was the Image taglib:

http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/intro.html

> -- 
> Martin Cooper
> 
> 
> But if you're using a 2.4 deployment descriptor -- check what's at
> 
>> the beginning of your application's web.xml -- upgrading to JSTL 1.1
>> is as simple as downloading and replacing a couple of jar files...
>>
>> And well worth it, IMO -- replacing all those ``
>> statements with `${path}` cleans up a workspace most wonderfully :-)
>>
>> FWIW!
>> -- 
>> Hassan Schroeder ----------------------------- hassan@webtuitive.com
>> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
>>                 opinion: webtuitive.blogspot.com
>>
>>                           dream.  code.

-- 
Kris Schneider 
D.O.Tech       

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



		
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.

Re: Runtime expressions with

Posted by Kris Schneider <kr...@dotech.com>.
Martin Cooper wrote:
> On 5/17/06, Hassan Schroeder <ha...@webtuitive.com> wrote:
> 
>>
>> Robert Bowen wrote:
>>
>> > No, "path = ${path} does not work. I am using JSTL 1.0 and Servlet 2.4.
>> >
>> > So can I do this? ...Without changing versions of JSTL / Servlet?
>>
>> short answer: no. Though I'm not sure where that <img:... tag comes
>> from, haven't used it myself.
> 
> 
> 
> Uh, that would be HTML...

;-) I had a WTF moment when I read your previous reply because I assumed it 
was the Image taglib:

http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/intro.html

> -- 
> Martin Cooper
> 
> 
> But if you're using a 2.4 deployment descriptor -- check what's at
> 
>> the beginning of your application's web.xml -- upgrading to JSTL 1.1
>> is as simple as downloading and replacing a couple of jar files...
>>
>> And well worth it, IMO -- replacing all those `<c:out value="${path}"/>`
>> statements with `${path}` cleans up a workspace most wonderfully :-)
>>
>> FWIW!
>> -- 
>> Hassan Schroeder ----------------------------- hassan@webtuitive.com
>> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
>>                 opinion: webtuitive.blogspot.com
>>
>>                           dream.  code.

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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


Re: Runtime expressions with

Posted by Martin Cooper <ma...@apache.org>.
On 5/17/06, Hassan Schroeder <ha...@webtuitive.com> wrote:
>
> Robert Bowen wrote:
>
> > No, "path = ${path} does not work. I am using JSTL 1.0 and Servlet 2.4.
> >
> > So can I do this? ...Without changing versions of JSTL / Servlet?
>
> short answer: no. Though I'm not sure where that <img:... tag comes
> from, haven't used it myself.


Uh, that would be HTML...

--
Martin Cooper


But if you're using a 2.4 deployment descriptor -- check what's at
> the beginning of your application's web.xml -- upgrading to JSTL 1.1
> is as simple as downloading and replacing a couple of jar files...
>
> And well worth it, IMO -- replacing all those `<c:out value="${path}"/>`
> statements with `${path}` cleans up a workspace most wonderfully :-)
>
> FWIW!
> --
> Hassan Schroeder ----------------------------- hassan@webtuitive.com
> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
>                 opinion: webtuitive.blogspot.com
>
>                           dream.  code.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>

Re: Runtime expressions with

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Robert Bowen wrote:

> No, "path = ${path} does not work. I am using JSTL 1.0 and Servlet 2.4.
> 
> So can I do this? ...Without changing versions of JSTL / Servlet?

short answer: no. Though I'm not sure where that <img:... tag comes
from, haven't used it myself.

But if you're using a 2.4 deployment descriptor -- check what's at
the beginning of your application's web.xml -- upgrading to JSTL 1.1
is as simple as downloading and replacing a couple of jar files...

And well worth it, IMO -- replacing all those `<c:out value="${path}"/>`
statements with `${path}` cleans up a workspace most wonderfully :-)

FWIW!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
                opinion: webtuitive.blogspot.com
				
                          dream.  code.



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


Re: Runtime expressions with

Posted by Robert Bowen <sy...@yahoo.com>.
Well how do you like that. Perhaps I should have mentioned I am a JSTL newbie, but I guess you already got that.

No, "path = ${path} does not work. I am using JSTL 1.0 and Servlet 2.4.

So can I do this? ...Without changing versions of JSTL / Servlet?

Thanks buckets,
Bob

Hassan Schroeder <ha...@webtuitive.com> wrote: Robert Bowen wrote:
> Is this possible? According to the docs it is. But when I try the following:
> 
> 
> 
> 
> 
> The page fails saying File Not Found: '${path}'. Meaning it's not 
> interpreting the path variable, but rather just spitting it back
> out as plain text. Yes, I have the core jstl libraries working
> properly, since the following statement:
> 
> path is 

is meaningless :-)  -- does

  path is ${path}

work? If not, you're not using JSTL 1.1 and/or Servlet 2.4, where
the *container* interprets/expands EL statements.

A more precise answer would be possible with actual information
about your configuration...

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
                opinion: webtuitive.blogspot.com
    
                          dream.  code.



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



		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

Re: Runtime expressions with

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Robert Bowen wrote:
> Is this possible? According to the docs it is. But when I try the following:
> 
> <c:set var="path" value="/images/splash.jpg" scope="page" />
> 
> <img:image src="${path}"/>
> 
> The page fails saying File Not Found: '${path}'. Meaning it's not 
> interpreting the path variable, but rather just spitting it back
> out as plain text. Yes, I have the core jstl libraries working
> properly, since the following statement:
> 
> path is <c:out value="${path}" />

is meaningless :-)  -- does

  path is ${path}

work? If not, you're not using JSTL 1.1 and/or Servlet 2.4, where
the *container* interprets/expands EL statements.

A more precise answer would be possible with actual information
about your configuration...

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
                opinion: webtuitive.blogspot.com
				
                          dream.  code.



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