From 9234664aa77df39d4d9713830ac6fc529e43624b Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 23 Dec 2009 20:05:25 +0000 Subject: [PATCH] JSP 2.2 - Add omit attribute to git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@893617 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/jasper/compiler/Generator.java | 4 ++++ java/org/apache/jasper/compiler/Node.java | 12 ++++++++++++ java/org/apache/jasper/compiler/Validator.java | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index a0e11aaa2..18c5bfbfc 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -1950,6 +1950,10 @@ class Generator { for (int i = 0; attrs != null && i < attrs.length; i++) { String attrStr = null; if (attrs[i].isNamedAttribute()) { + if (attrs[i].getNamedAttributeNode().isOmit()) { + // Skip this attribute - JSP.5-7 + continue; + } attrStr = generateNamedAttributeValue(attrs[i] .getNamedAttributeNode()); } else { diff --git a/java/org/apache/jasper/compiler/Node.java b/java/org/apache/jasper/compiler/Node.java index 238881560..1f0852c81 100644 --- a/java/org/apache/jasper/compiler/Node.java +++ b/java/org/apache/jasper/compiler/Node.java @@ -1864,6 +1864,10 @@ abstract class Node implements TagConstants { // True if this node is to be trimmed, or false otherwise private boolean trim = true; + // True if this attribute should be omitted from the output if + // used with a , otherwise false + private boolean omit = false; + private ChildInfo childInfo; private String name; @@ -1886,6 +1890,10 @@ abstract class Node implements TagConstants { // (if null or true, leave default of true) trim = false; } + if ("true".equals(this.getAttributeValue("omit"))) { + // (if null or false, leave default of false) + omit = true; + } childInfo = new ChildInfo(); name = this.getAttributeValue("name"); if (name != null) { @@ -1925,6 +1933,10 @@ abstract class Node implements TagConstants { return trim; } + public boolean isOmit() { + return omit; + } + /** * @return A unique temporary variable name to store the result in. * (this probably could go elsewhere, but it's convenient here) diff --git a/java/org/apache/jasper/compiler/Validator.java b/java/org/apache/jasper/compiler/Validator.java index f9035e80b..2474456f6 100644 --- a/java/org/apache/jasper/compiler/Validator.java +++ b/java/org/apache/jasper/compiler/Validator.java @@ -482,7 +482,8 @@ class Validator { private static final JspUtil.ValidAttribute[] attributeAttrs = { new JspUtil.ValidAttribute("name", true), - new JspUtil.ValidAttribute("trim") }; + new JspUtil.ValidAttribute("trim"), + new JspUtil.ValidAttribute("omit")}; private static final JspUtil.ValidAttribute[] invokeAttrs = { new JspUtil.ValidAttribute("fragment", true), -- 2.11.0