File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP Expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Expression" Watch "JSP Expression" New topic

JSP Expression

shiva rao
Ranch Hand

Joined: May 26, 2005
Posts: 31
Here is my Jsp source.

String text="Welcome to Expression language";
Welcome to the jsp programming.
<strong>If you see this page, it means jsp are also funtioning properly.</strong>
Text = ${text}

When I deploy this jsp on tomcat server. For some reason expression ${text} is not replaced with the text Instead I am just seeing ${text} as is was.

Expected output for the expression part is :
Text = Welcome to Expression language

Did I miss something here.


[ November 22, 2005: Message edited by: shiva rao ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
"Did I miss something here."

Yes, the correct forum. Moving to JSP...

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Derek Clarkson

Joined: Mar 04, 2004
Posts: 25
Hmmm, you might want to check the server versions you are on and what JSTL and EL they support. Without checking myself, I remember reading that only the very latest spec versions support using ${test} inside the html in this manner. Previous versions of the spec do not support this and you will need to use

Instead. Check up on the JSTL tags and how to use them.
[ November 22, 2005: Message edited by: Derek Clarkson ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

What version of Tomcat? Is your web app declared as a Servlet 2.4 web app? (See JSP FAQ)

The fact that the EL expression is not being evaluated means that the EL is not enabled. You must be using a JSP 2.0 container (Tomcat 5) and the web app must be declared as 2.4.


once the EL is enabled you will fnd that this does not do what you expect.

The variable text is a scripting variable, while the EL operates upon scoped variables.
[ November 22, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
shiva rao
Ranch Hand

Joined: May 26, 2005
Posts: 31
Thanks a lot for the reply. Here are the server details:

I am using Tomcat 5.5 and it supports JSP 2.0.
Here are the common jars it is refering to .


And can you guys tell me how do I know whether server enabled or disabled the EL. And also where can I do that.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

There is an entry in the JSP FAQ.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
As posted above, make sure the top of your DD is defined as using 2.4 as below

So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: JSP Expression
jQuery in Action, 3rd edition