https://issues.apache.org/bugzilla/show_bug.cgi?id=56029
Bug ID: 56029
Summary: Ternary operator doesn't work as expected inside
attributes in jspx pages
Product: Tomcat 7
Version: 7.0.50
Hardware: All
OS: Mac OS X 10.4
Status: NEW
Severity: major
Priority: P2
Component: Jasper
Assignee: [email protected]
Reporter: [email protected]
The following JSPX file worked upto Tomcat 7.0.47:
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>
<jsp:directive.page contentType="text/html; charset=utf-8"
pageEncoding="UTF-8" />
<jsp:directive.page session="false" />
<jsp:output omit-xml-declaration="true" />
<div>
<span id="mainNavNews" class="${currentController eq 'News' ?
'selectedItem' : ''}">foobar</span>
</div>
</jsp:root>
With tomcat 7.0.50 it fails with the following exception:
org.apache.jasper.JasperException: /WEB-INF/views/layouts/mainNavigation.jspx
(line: 10, column: 87) "${currentController eq 'News' ? 'selectedItem' : ''}"
contains invalid expression(s): javax.el.ELException: Failed to parse the
expression [${currentControllereq'News'?'selectedItem':''}]
at
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
at
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443)
at
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:199)
at
org.apache.jasper.compiler.Validator$ValidateVisitor.getJspAttribute(Validator.java:1399)
at
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:772)
at org.apache.jasper.compiler.Node$UninterpretedTag.accept(Node.java:1251)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2375)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2427)
at
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:779)
at org.apache.jasper.compiler.Node$UninterpretedTag.accept(Node.java:1251)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2375)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2427)
at
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:529)
at org.apache.jasper.compiler.Node$JspRoot.accept(Node.java:564)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2375)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2427)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2433)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:474)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2375)
at
org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1817)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217)
at org.apache.jasper.compiler.Compiler.__compile(Compiler.java:373)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
at
org.apache.jasper.servlet.JspServlet._serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
It works when the ternary operation doesn't appear inside an attribute or
instead of eq '==' is used.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]