• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP 2.1 and Unified EL 2.1

 
Johnnie Smith
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have Tomcat version 6.0.35 that supports JSP 2.1 and Servlet 2.4 installed on my system. It is said in the EL specification that JSP 2.1 includes the Unified

Expression Language 2.1. However when I code a simple JSP file to display "Hello World" message i.e. #{"Hello World"} instead of ${"Hello World"} , the JSP file does

not compile.

Can somebody tell me why this occurs? Isnt the Unified EL supported in JSP files? Is it only for .JSF files?

Thanks & Regards,
John
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What possible use would deferred expressions have in a JSP?
 
Johnnie Smith
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know about the use of deferred expressions in JSP as they are used in JSF to the best of my knowledge. I work with JSP, not JSF.

When I switched to JSP 2.1, I found these new topics in JSP 2.1 and EL 2.1 specifications. I tried to use the new stuff on my JSP in order to comprehend the new syntax but got the above mentioned problem.

 
Stefan Evans
Bartender
Posts: 1692
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the preface section of the JSP2.1 specification.
Deferred expressions only really apply to custom tags where you have specified that the attribute is deferred.
For the most part, I don't bother with them.

Basically
If you use #{deferredSyntax} in template text, it triggers a translation error (they don't make sense outside of a tag attribute)
If you use #{deferredSyntax} in a tag attribute, it depends upon the tld declaration for what version of JSP that taglib supports.
- JSP version supported < 2.1 == treat as literal
- JSP version supported >= 2.1 : treat as deferred attribute - as long as it is marked as such.

You can set the page attribute:


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic