WW-2132 Add support for JSP tag library dynamic attributes
git-svn-id: https://svn.apache.org/repos/asf/struts/maven/trunk/struts-annotations@572764 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/struts/annotations/taglib/apt/Tag.java b/src/main/java/org/apache/struts/annotations/taglib/apt/Tag.java
index 4ba1444..175bd46 100644
--- a/src/main/java/org/apache/struts/annotations/taglib/apt/Tag.java
+++ b/src/main/java/org/apache/struts/annotations/taglib/apt/Tag.java
@@ -31,6 +31,7 @@
private String tldBodyContent;
private String tldTagClass;
private String description;
+ private boolean allowDynamicAttributes;
private boolean include = true;
private String declaredType;
private Map<String, TagAttribute> attributes = new TreeMap<String, TagAttribute>();
@@ -85,6 +86,14 @@
this.include = include;
}
+ public boolean isAllowDynamicAttributes() {
+ return allowDynamicAttributes;
+ }
+
+ public void setAllowDynamicAttributes(boolean allowDynamicAttributes) {
+ this.allowDynamicAttributes = allowDynamicAttributes;
+ }
+
public String getDeclaredType() {
return declaredType;
}
diff --git a/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java b/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
index d1d42f2..6b75f32 100644
--- a/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
+++ b/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
@@ -114,6 +114,7 @@
tag.setTldBodyContent((String) values.get("tldBodyContent"));
tag.setTldTagClass((String) values.get("tldTagClass"));
tag.setDeclaredType(typeName);
+ tag.setAllowDynamicAttributes((Boolean) values.get("allowDynamicAttributes"));
// add to map
tags.put(typeName, tag);
}
@@ -318,12 +319,14 @@
// taglib
Element tagLib = document.createElement("taglib");
+ tagLib.setAttribute("xmlns", "http://java.sun.com/xml/ns/j2ee");
+ tagLib.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ tagLib.setAttribute("xsi:schemaLocation", "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd");
+ tagLib.setAttribute("version", getOption("jspVersion"));
document.appendChild(tagLib);
// tag lib attributes
appendTextNode(document, tagLib, "tlib-version",
getOption("tlibVersion"), false);
- appendTextNode(document, tagLib, "jsp-version",
- getOption("jspVersion"), false);
appendTextNode(document, tagLib, "short-name",
getOption("shortName"), false);
appendTextNode(document, tagLib, "uri", getOption("uri"), false);
@@ -348,10 +351,6 @@
// (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6296446)
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,
- "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN");
- transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,
- "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
Source source = new DOMSource(document);
@@ -397,6 +396,7 @@
createElement(doc, tagElement, attribute);
}
+ appendTextNode(doc, tagElement, "dynamic-attributes", String.valueOf(tag.isAllowDynamicAttributes()), false);
}
private void createElement(Document doc, Element tagElement,