jQuery in Action, 3rd edition
The moose likes JSP and the fly likes jstl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jstl "expression language ( "${...}" ) in static text" Watch "jstl "expression language ( "${...}" ) in static text" New topic

jstl "expression language ( "${...}" ) in static text

Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311

I'm a newbie user of jstl "expression language" .
I've got it to work *within tags*, but not in static text.
Here's how i use it in a tag: <c ut value="${2+2}" >.
This works fine and prints out "4".

But here's how I use it in static text:
<html> This is some static text ${2+2} </html>
This does not evaluate to "4"... instead, it literally prints out ${2+2}.

I'm using tomcat 5 with jakarta's implementation for jstl.
I've even added the following to my web.xml :
< el-enabled>true < / el-enabled >
It did not help.
Am I doing it wrong ? I've double-checked with various web tutorials, and they all state that EL *should* work with static text...

Thanks !
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

Two things:

1) Be sure that your web app is declared as a Servlet 2.4 web app in the web.xml

2) Be sure that you are using a JSTL 1.1 implementation

[Asking smart questions] [About Bear] [Books by Bear]
Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311
Thanks a million, your quick reply has been a real life saver ))

For anyone reading this, if you need to configure tomcat for 2.4 spec, here's a link I found useful:

I agree. Here's the link: http://aspose.com/file-tools
subject: jstl "expression language ( "${...}" ) in static text
It's not a secret anymore!