[Logo]
Forums Register Login
problem in displaying EL


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 ]
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.
 
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)...


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.
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}
??
 
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.
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.
 
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???
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.
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.
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.

Thanks Stefan.

It was nice eaplanation.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Nov 23, 2017 23:05:04.