aspose file tools*
The moose likes JSP and the fly likes Expression Not Being Evaluated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Expression Not Being Evaluated" Watch "Expression Not Being Evaluated" New topic
Author

Expression Not Being Evaluated

Elton Hughes
Ranch Hand

Joined: Jun 19, 2003
Posts: 72
Hello All,

I am learning JSP and I ran into a small problem. I have a very simple JSP file that contains this line:

2 + 2 is ${2 + 2}

When the line is evaluated by Tomcat, it listed the line as typed. I am using Tomcat 4.1.31. Could that be the problem? Or is it something else?

Thanks,

Elton
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61769
    
  67

Use of the expression language in template text is a JSP 2.0 feature. Tomcat 4 is not JSP 2.0 compliant.

Why not just upgrade to Tomcat 5?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1029
In a JSP1.2 container you can only use EL expressions in the JSTL tags.
Which was the whole point of the <cut> tag.

2 + 2 = <cut value="${2 + 2}"/>

The <cut> tag still remains useful though, as it escapes html characters automatically, something that just putting an EL expression on the page won't do.
Elton Hughes
Ranch Hand

Joined: Jun 19, 2003
Posts: 72
Thank you Bear and Stefan for your input.

I think I will upgrade to Tomcat 5. It looks like 5.5.9 is the latest stable version. I have additional questions and will ask them in the appropriate forum.

Thanks once again.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61769
    
  67

Be aware that Tomcat 5.5 requires Java 1.5 (unless you want to finagle a bit). Tomcat 5.0.x runs on Java 1.4.
Elton Hughes
Ranch Hand

Joined: Jun 19, 2003
Posts: 72
Thanks Bear! That was going to be my next question asked over in the Tomcat forum.

Cheers!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Expression Not Being Evaluated