Bug 49799 - The new JSP 2.2 omit-attribute in jsp:attribute does not work with EL or expressions
The new JSP 2.2 omit-attribute in jsp:attribute does not work with EL or expr...
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Jasper
7.0.2
PC Windows Vista
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-08-22 16:44 UTC by PhilippJ
Modified: 2010-08-30 18:33 UTC (History)
0 users



Attachments
A JSP file which show three different use cases of the jsp:attribute omit attribute (1.19 KB, application/octet-stream)
2010-08-22 16:44 UTC, PhilippJ
Details

Note You need to log in before you can comment on or make changes to this bug.
Description PhilippJ 2010-08-22 16:44:10 UTC
Created attachment 25926 [details]
A JSP file which show three different use cases of the jsp:attribute omit attribute

I'm trying to make use of the new omit-attribute in the jsp:attribute. This new feature of JSP 2.2 is described in the Specs in JSP.5.10.

Table JSP.5-7 Attributes for the <jsp:attribute> standard action

omit (optional) Valid values are true and false. If true, and when
used with <jsp:element>, the attribute in the element being
ouput is omitted. Ignored when used with a standard or
custom action. Defaults to false.

There is an introduction text here: 
http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14471459

and I'm trying to make this work in my setup but I'm failing. Or I don't get the point.

The following works:
<jsp:element name="p">
	<jsp:attribute name="style" omit="true" >color:red</jsp:attribute>

The following does NOT work:
<jsp:element name="p">
	<jsp:attribute name="style" omit="<%=jspExpressionTrue%>" >color:red</jsp:attribute>

The following does NOT work either:
<jsp:element name="p">
	<jsp:attribute name="style" omit="${trueEL}" >color:red</jsp:attribute>

Full JSP code in my attachment. I actually use the JSP-document (XML / JSPX-)syntax, but it does not work in any of the JSP dialects.


So I don't get the point why I should not be able to use EL in the omit-attribute, because then it's kind of useless.


I use
Windows Vista 64bit
JavaSE 1.6
Apache Tomcat 7.0.0 and Apche Tomcat 7.0.2beta
JSTL 1.1.2

All setup together in a typical "Dynamic Web Project" in Eclipse 3.6 Helios
Comment 1 Mark Thomas 2010-08-30 12:10:24 UTC
The expected behaviour is undefined since the EBNF in JSP.1.3.10.1 does not include the omit attribute at all.

The behaviour you are expecting sounds reasonable to me (even if it does make the code a tad more complicated than it is currently). I'm working on a patch and should have something soon. I'll also try and nag the EG about the error in the EBNF.
Comment 2 Mark Thomas 2010-08-30 18:33:33 UTC
I have fixed this in trunk. It will be included in 7.0.3 onwards.