• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL and ? : construct

 
DenisS Simpson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to do something like this
${true ? 'A': 'B'}

but I get an error

An error occurred while evaluating custom action attribute "value" with value "${true ? 'A' : 'B'}": Encountered "?", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||"] (null)

According to O'Reilly's "JavaServer Pages" condition ? ifTrue : ifFalse operator is allowed. Is book wrong?

PS I am using WebLogic
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of JSP are you using? The ternary operator was introduced to the EL with JSP 2.0.
 
DenisS Simpson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP 2.0
Running on WebLogic 8
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should work then. I use it regularly on Tomcat 5 and Resin 3.

Is your web.xml declared as a Servlets 2.4 deployment descriptor? If not, the EL shouldn't be enabled on the pages at all, but I don't know how closely weblogic follows the JSP 2.0 spec and it might just be using some weird pre-JSP 2.0 compatability mode.
 
DenisS Simpson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have an entry for Servlets 2.4 descriptor.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this JSP FAQ entry.
[ February 10, 2006: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic