Author: jholmes Date: Tue Sep 4 11:11:18 2007 New Revision: 572764 URL: http://svn.apache.org/viewvc?rev=572764&view=rev Log: WW-2132 Add support for JSP tag library dynamic attributes
Modified: struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/Tag.java struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java Modified: struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/Tag.java URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/Tag.java?rev=572764&r1=572763&r2=572764&view=diff ============================================================================== --- struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/Tag.java (original) +++ struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/Tag.java Tue Sep 4 11:11:18 2007 @@ -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; } Modified: struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java?rev=572764&r1=572763&r2=572764&view=diff ============================================================================== --- struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java (original) +++ struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java Tue Sep 4 11:11:18 2007 @@ -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,