Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in displaying EL  RSS feed

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66200
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 3830
  • Mark post as helpful
  • send pies
  • 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)...


 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • 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.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • 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: 3830
  • Mark post as helpful
  • send pies
  • 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.
 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • 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 cut gets evaluated to value. and as far as i know evn the EL should have been evaluated.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • 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 cut 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???
 
Stefan Evans
Bartender
Posts: 1836
10
  • Mark post as helpful
  • send pies
  • 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
  • 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: 1836
10
  • Mark post as helpful
  • send pies
  • 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: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stefan.

It was nice eaplanation.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!