• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem in displaying EL

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Why, the output of above code is: ${key} ${key} and not the value value???



[ July 11, 2006: Message edited by: rathi ji ]
[ July 11, 2006: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The most likely reason is that your web app is mis-configured so that the EL is not enabled on your page.

See the JSP FAQ for info on correctly configuring your web app.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
The most likely reason is that your web app is mis-configured so that the EL is not enabled on your page.

See the JSP FAQ for info on correctly configuring your web app.



Tomcat version is 5.0 (I checked in RELEASE-NOTES).
JSP container version is 2.0 (in RELEASE-NOTES, I found an entry like this: * jsp-api.jar (JSP 2.0 API))

This means, I need JSTL 1.1. But I don't know what's the version of my jstl.jar and standard.jar (how to check that?) (but I took it from webapps\jsp-examples\WEB-INF\lib location so it is supposed be compatible with my tomcat and JSP container)...


 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can download JSTL 1.1 from here. However that's only for jstl tags. If you have setup your application correctly, EL should have worked.

ram.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way your jstl code is correct it should output

${key}value



it is strange what you get in out put what is the html really out !

and if you are in 2.0 is it not better to use directly key:${key}
??
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ramprasad madathil:
You can download JSTL 1.1 from here. However that's only for jstl tags. If you have setup your application correctly, EL should have worked.

ram.



Thanks Ramprasad.
It worked with JAR you provided.



Benjamin, I did't get your post, but just to clarify, printing key:${key} was not my aim. Anyway, thanks.
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
rathi ji,

can you please tell me what was the output..


'${key} value'...

or even ${key}, gets evaluated to 'value'.. and the o/p is 'value value'

because i tried it. .n c:out gets evaluated to value. and as far as i know evn the EL should have been evaluated.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by geetu lalchandani:
rathi ji,

can you please tell me what was the output..


'${key} value'...

or even ${key}, gets evaluated to 'value'.. and the o/p is 'value value'

because i tried it. .n c:out gets evaluated to value. and as far as i know evn the EL should have been evaluated.



The output is: value value

Why ${key} should not be evaluated???
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you were in a JSP1.2 container (eg Tomcat4) that doesn't understand EL on its own, then you would expect that output.

In JSP1.2, you can only use EL expressions in the JSTL tags (and certain other tags that have been specifically programmed to allow it)

JSP2.0 moved the responsibility for evaluating the EL expression from the JSTL tags where it was before, to the container. For backwards compatibility though, this is only enabled if you update your web.xml to declare it supports the Servlet2.4 spec.

Hence the incompatibilities and confusion between JSTL1.0 and JSTL1.1, with different versions of Tomcat, and the web.xml file.
 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
rathi ji,

can you pls tell which jsp container version you have. and the version of the jar.

And Stefan, is it that only replacing the JSTL jar with the newer version will evaluate the EL without the custom tag.
 
Stefan Evans
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you look up above, Rathi said that he had Tomcat 5 (Servlet2.4/JSP2.0)
The issue was probably fixed by updating web.xml to declare itself as 2.4 (see the FAQ)

>And Stefan, is it that only replacing the JSTL jar with the newer version
>will evaluate the EL without the custom tag.
No. Replacing the JSTL jars will not do anything. It is the server itself that needs to be upgraded.

A JSP2.0 container (eg Tomcat 5) will evaluate EL (if web.xml is configured correctly)
A JSP1.2 container (eg Tomcat 4) knows nothing about it.


My post was an attempt to clarify why the case that Benjamin posted might occur (ie where expression in the tag is evaluated, and the one outside the tag is not). Obviously it failed.

 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Stefan.

It was nice eaplanation.
reply
    Bookmark Topic Watch Topic
  • New Topic