This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Expression Not Being Evaluated

 
Elton Hughes
Ranch Hand
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Stefan Evans
Bartender
Posts: 1640
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear! That was going to be my next question asked over in the Tomcat forum.

Cheers!
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic