Author: jholmes Date: Tue Aug 28 10:38:36 2007 New Revision: 570496 URL: http://svn.apache.org/viewvc?rev=570496&view=rev Log: WW-2132 Add support for JSP tag library dynamic attributes
Added: struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Anchor-2.txt Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Anchor.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Checkbox.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Div.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/File.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Hidden.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Label.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/OptGroup.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Password.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Reset.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Select.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Submit.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Text.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TextArea.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TextField.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/annotations/StrutsTag.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java struts/struts2/trunk/core/src/main/resources/template/simple/a.ftl struts/struts2/trunk/core/src/main/resources/template/simple/checkbox.ftl struts/struts2/trunk/core/src/main/resources/template/simple/div.ftl struts/struts2/trunk/core/src/main/resources/template/simple/file.ftl struts/struts2/trunk/core/src/main/resources/template/simple/form.ftl struts/struts2/trunk/core/src/main/resources/template/simple/hidden.ftl struts/struts2/trunk/core/src/main/resources/template/simple/label.ftl struts/struts2/trunk/core/src/main/resources/template/simple/optgroup.ftl struts/struts2/trunk/core/src/main/resources/template/simple/password.ftl struts/struts2/trunk/core/src/main/resources/template/simple/reset.ftl struts/struts2/trunk/core/src/main/resources/template/simple/select.ftl struts/struts2/trunk/core/src/main/resources/template/simple/submit.ftl struts/struts2/trunk/core/src/main/resources/template/simple/text.ftl struts/struts2/trunk/core/src/main/resources/template/simple/textarea.ftl struts/struts2/trunk/core/src/site/resources/tags/ajax/a.html struts/struts2/trunk/core/src/site/resources/tags/ajax/autocompleter.html struts/struts2/trunk/core/src/site/resources/tags/ajax/datetimepicker.html struts/struts2/trunk/core/src/site/resources/tags/ajax/div.html struts/struts2/trunk/core/src/site/resources/tags/ajax/submit.html struts/struts2/trunk/core/src/site/resources/tags/ajax/tabbedpanel.html struts/struts2/trunk/core/src/site/resources/tags/ajax/tree.html struts/struts2/trunk/core/src/site/resources/tags/ajax/treenode.html struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Anchor.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Anchor.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Anchor.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Anchor.java Tue Aug 28 10:38:36 2007 @@ -46,7 +46,11 @@ * </pre> * */ [EMAIL PROTECTED](name="a", tldTagClass="org.apache.struts2.views.jsp.ui.AnchorTag", description="Render a HTML href element that when clicked can optionally call a URL via remote XMLHttpRequest and updates its targets") [EMAIL PROTECTED]( + name="a", + tldTagClass="org.apache.struts2.views.jsp.ui.AnchorTag", + description="Render a HTML href element that when clicked can optionally call a URL via remote XMLHttpRequest and updates its targets", + allowDynamicAttributes=true) public class Anchor extends ClosingUIBean { public static final String OPEN_TEMPLATE = "a"; public static final String TEMPLATE = "a-close"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Checkbox.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Checkbox.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Checkbox.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Checkbox.java Tue Aug 28 10:38:36 2007 @@ -50,7 +50,11 @@ * </pre> * */ [EMAIL PROTECTED](name="checkbox", tldTagClass="org.apache.struts2.views.jsp.ui.CheckboxTag", description="Render a checkbox input field") [EMAIL PROTECTED]( + name="checkbox", + tldTagClass="org.apache.struts2.views.jsp.ui.CheckboxTag", + description="Render a checkbox input field", + allowDynamicAttributes=true) public class Checkbox extends UIBean { final public static String TEMPLATE = "checkbox"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Div.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Div.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Div.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Div.java Tue Aug 28 10:38:36 2007 @@ -33,7 +33,11 @@ * <!-- END SNIPPET: javadoc --> * */ [EMAIL PROTECTED](name="div", tldTagClass="org.apache.struts2.views.jsp.ui.DivTag", description="Render an HTML div") [EMAIL PROTECTED]( + name="div", + tldTagClass="org.apache.struts2.views.jsp.ui.DivTag", + description="Render an HTML div", + allowDynamicAttributes=true) public class Div extends ClosingUIBean { public static final String TEMPLATE = "div"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/File.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/File.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/File.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/File.java Tue Aug 28 10:38:36 2007 @@ -45,7 +45,11 @@ * </pre> * */ [EMAIL PROTECTED](name="file", tldTagClass="org.apache.struts2.views.jsp.ui.FileTag", description="Render a file input field") [EMAIL PROTECTED]( + name="file", + tldTagClass="org.apache.struts2.views.jsp.ui.FileTag", + description="Render a file input field", + allowDynamicAttributes=true) public class File extends UIBean { private final static Log log = LogFactory.getLog(File.class); Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java Tue Aug 28 10:38:36 2007 @@ -80,7 +80,11 @@ * </pre> * */ [EMAIL PROTECTED](name="form", tldTagClass="org.apache.struts2.views.jsp.ui.FormTag", description="Renders an input form") [EMAIL PROTECTED]( + name="form", + tldTagClass="org.apache.struts2.views.jsp.ui.FormTag", + description="Renders an input form", + allowDynamicAttributes=true) public class Form extends ClosingUIBean { public static final String OPEN_TEMPLATE = "form"; public static final String TEMPLATE = "form-close"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Hidden.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Hidden.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Hidden.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Hidden.java Tue Aug 28 10:38:36 2007 @@ -49,7 +49,11 @@ * </pre> * */ [EMAIL PROTECTED](name="hidden", tldTagClass="org.apache.struts2.views.jsp.ui.HiddenTag", description="Render a hidden input field") [EMAIL PROTECTED]( + name="hidden", + tldTagClass="org.apache.struts2.views.jsp.ui.HiddenTag", + description="Render a hidden input field", + allowDynamicAttributes=true) public class Hidden extends UIBean { final public static String TEMPLATE = "hidden"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Label.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Label.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Label.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Label.java Tue Aug 28 10:38:36 2007 @@ -53,8 +53,11 @@ * </pre> * */ [EMAIL PROTECTED](name="label", tldTagClass="org.apache.struts2.views.jsp.ui.LabelTag", description="Render a label that displays" + - " read-only information") [EMAIL PROTECTED]( + name="label", + tldTagClass="org.apache.struts2.views.jsp.ui.LabelTag", + description="Render a label that displays read-only information", + allowDynamicAttributes=true) public class Label extends UIBean { final public static String TEMPLATE = "label"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/OptGroup.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/OptGroup.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/OptGroup.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/OptGroup.java Tue Aug 28 10:38:36 2007 @@ -71,7 +71,11 @@ * </pre> * */ [EMAIL PROTECTED](name="optgroup", tldTagClass="org.apache.struts2.views.jsp.ui.OptGroupTag", description="Renders a Select Tag's OptGroup Tag") [EMAIL PROTECTED]( + name="optgroup", + tldTagClass="org.apache.struts2.views.jsp.ui.OptGroupTag", + description="Renders a Select Tag's OptGroup Tag", + allowDynamicAttributes=true) public class OptGroup extends Component { public static final String INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY = "optGroupInternalListUiBeanList"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Password.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Password.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Password.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Password.java Tue Aug 28 10:38:36 2007 @@ -46,7 +46,11 @@ * </pre> * */ [EMAIL PROTECTED](name="password", tldTagClass="org.apache.struts2.views.jsp.ui.PasswordTag", description="Render an HTML input tag of type password") [EMAIL PROTECTED]( + name="password", + tldTagClass="org.apache.struts2.views.jsp.ui.PasswordTag", + description="Render an HTML input tag of type password", + allowDynamicAttributes=true) public class Password extends TextField { final public static String TEMPLATE = "password"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Reset.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Reset.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Reset.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Reset.java Tue Aug 28 10:38:36 2007 @@ -56,7 +56,11 @@ * </pre> * */ [EMAIL PROTECTED](name="reset", tldTagClass="org.apache.struts2.views.jsp.ui.ResetTag", description="Render a reset button") [EMAIL PROTECTED]( + name="reset", + tldTagClass="org.apache.struts2.views.jsp.ui.ResetTag", + description="Render a reset button", + allowDynamicAttributes=true) public class Reset extends FormButton { final public static String TEMPLATE = "reset"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Select.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Select.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Select.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Select.java Tue Aug 28 10:38:36 2007 @@ -78,7 +78,11 @@ * <!-- END SNIPPET: exnote --> * */ [EMAIL PROTECTED](name="select", tldTagClass="org.apache.struts2.views.jsp.ui.SelectTag", description="Render a select element") [EMAIL PROTECTED]( + name="select", + tldTagClass="org.apache.struts2.views.jsp.ui.SelectTag", + description="Render a select element", + allowDynamicAttributes=true) public class Select extends ListUIBean { final public static String TEMPLATE = "select"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Submit.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Submit.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Submit.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Submit.java Tue Aug 28 10:38:36 2007 @@ -45,7 +45,11 @@ * text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0 * <!-- END SNIPPET: javadoc --> */ [EMAIL PROTECTED](name="submit", tldTagClass="org.apache.struts2.views.jsp.ui.SubmitTag", description="Render a submit button") [EMAIL PROTECTED]( + name="submit", + tldTagClass="org.apache.struts2.views.jsp.ui.SubmitTag", + description="Render a submit button", + allowDynamicAttributes=true) public class Submit extends FormButton { private static final Log LOG = LogFactory.getLog(Submit.class); Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Text.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Text.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Text.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Text.java Tue Aug 28 10:38:36 2007 @@ -113,7 +113,11 @@ * @see Param * */ [EMAIL PROTECTED](name="text", tldTagClass="org.apache.struts2.views.jsp.TextTag", description="Render a I18n text message") [EMAIL PROTECTED]( + name="text", + tldTagClass="org.apache.struts2.views.jsp.TextTag", + description="Render a I18n text message", + allowDynamicAttributes=true) public class Text extends ContextBean implements Param.UnnamedParametric { private static final Log LOG = LogFactory.getLog(Text.class); Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TextArea.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TextArea.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TextArea.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TextArea.java Tue Aug 28 10:38:36 2007 @@ -44,7 +44,11 @@ * @see TabbedPanel * */ [EMAIL PROTECTED](name="textarea", tldTagClass="org.apache.struts2.views.jsp.ui.TextareaTag", description="Render HTML textarea tag.") [EMAIL PROTECTED]( + name="textarea", + tldTagClass="org.apache.struts2.views.jsp.ui.TextareaTag", + description="Render HTML textarea tag.", + allowDynamicAttributes=true) public class TextArea extends UIBean { final public static String TEMPLATE = "textarea"; Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TextField.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TextField.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TextField.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TextField.java Tue Aug 28 10:38:36 2007 @@ -51,7 +51,11 @@ * </pre> */ [EMAIL PROTECTED](name="textfield", tldTagClass="org.apache.struts2.views.jsp.ui.TextFieldTag", description="Render an HTML input field of type text") [EMAIL PROTECTED]( + name="textfield", + tldTagClass="org.apache.struts2.views.jsp.ui.TextFieldTag", + description="Render an HTML input field of type text", + allowDynamicAttributes=true) public class TextField extends UIBean { /** * The name of the default template for the TextFieldTag Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java Tue Aug 28 10:38:36 2007 @@ -21,6 +21,7 @@ package org.apache.struts2.components; import java.io.Writer; +import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -465,6 +466,9 @@ protected String tooltipDelay; protected String tooltipCssClass; protected String tooltipIconPath; + + // dynamic attributes + protected Map<String,Object> dynamicAttributes = new HashMap<String,Object>(); protected String defaultTemplateDir; protected String defaultUITheme; @@ -760,9 +764,6 @@ } - - - // tooltip & tooltipConfig if (tooltipConfig != null) { addParameter("tooltipConfig", findValue(tooltipConfig)); @@ -821,8 +822,10 @@ } - evaluateExtraParams(); + addParameter("dynamicAttributes", dynamicAttributes); + + evaluateExtraParams(); } protected String escape(String name) { @@ -1136,5 +1139,9 @@ @StrutsTagAttribute(description="Icon path used for image that will have the tooltip") public void setTooltipIconPath(String tooltipIconPath) { this.tooltipIconPath = tooltipIconPath; + } + + public void setDynamicAttributes(Map<String,Object> dynamicAttributes) { + this.dynamicAttributes = dynamicAttributes; } } Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/annotations/StrutsTag.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/annotations/StrutsTag.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/annotations/StrutsTag.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/annotations/StrutsTag.java Tue Aug 28 10:38:36 2007 @@ -39,4 +39,6 @@ String tldTagClass(); String description(); + + boolean allowDynamicAttributes() default false; } Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java Tue Aug 28 10:38:36 2007 @@ -20,6 +20,12 @@ */ package org.apache.struts2.views.jsp.ui; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.DynamicAttributes; + import org.apache.struts2.components.UIBean; import org.apache.struts2.views.jsp.ComponentTagSupport; @@ -28,7 +34,7 @@ * Abstract base class for all UI tags. * */ -public abstract class AbstractUITag extends ComponentTagSupport { +public abstract class AbstractUITag extends ComponentTagSupport implements DynamicAttributes { protected String cssClass; protected String cssStyle; protected String title; @@ -71,6 +77,9 @@ protected String tooltipCssClass; protected String tooltipIconPath; + // dynamic attributes. + protected Map<String,Object> dynamicAttributes = new HashMap<String,Object>(); + protected void populateParams() { super.populateParams(); @@ -114,6 +123,8 @@ uiBean.setAccesskey(accesskey); uiBean.setKey(key); uiBean.setId(id); + + uiBean.setDynamicAttributes(dynamicAttributes); } public void setId(String id) { @@ -266,5 +277,9 @@ public void setLabelSeparator(String labelSeparator) { this.labelSeparator = labelSeparator; - } + } + + public void setDynamicAttribute(String uri, String localName, Object value) throws JspException { + dynamicAttributes.put(localName, value); + } } Modified: struts/struts2/trunk/core/src/main/resources/template/simple/a.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/a.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/a.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/a.ftl Tue Aug 28 10:38:36 2007 @@ -41,4 +41,5 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> > Modified: struts/struts2/trunk/core/src/main/resources/template/simple/checkbox.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/checkbox.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/checkbox.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/checkbox.ftl Tue Aug 28 10:38:36 2007 @@ -47,5 +47,6 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> /> <input type="hidden" name="__checkbox_${parameters.name?html}" value="${parameters.fieldValue?html}" /> Modified: struts/struts2/trunk/core/src/main/resources/template/simple/div.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/div.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/div.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/div.ftl Tue Aug 28 10:38:36 2007 @@ -29,4 +29,5 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> > Added: struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl?rev=570496&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl (added) +++ struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl Tue Aug 28 10:38:36 2007 @@ -0,0 +1,28 @@ +<#-- +/* + * $Id: Action.java 502296 2007-02-01 17:33:39Z niallp $ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +--> +<#if (parameters.dynamicAttributes?exists && parameters.dynamicAttributes?size > 0)><#t/> + <#assign aKeys = parameters.dynamicAttributes.keySet()><#t/> + <#list aKeys as aKey><#t/> + ${aKey}="${parameters.dynamicAttributes[aKey]?html}"<#rt/> + </#list><#t/> +</#if><#t/> \ No newline at end of file Modified: struts/struts2/trunk/core/src/main/resources/template/simple/file.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/file.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/file.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/file.ftl Tue Aug 28 10:38:36 2007 @@ -51,4 +51,5 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> /> Modified: struts/struts2/trunk/core/src/main/resources/template/simple/form.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/form.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/form.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/form.ftl Tue Aug 28 10:38:36 2007 @@ -63,4 +63,5 @@ <#if parameters.acceptcharset?exists> accept-charset="${parameters.acceptcharset?html}"<#rt/> </#if> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> > Modified: struts/struts2/trunk/core/src/main/resources/template/simple/hidden.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/hidden.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/hidden.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/hidden.ftl Tue Aug 28 10:38:36 2007 @@ -34,4 +34,5 @@ <#if parameters.cssStyle?exists> style="${parameters.cssStyle?html}"<#rt/> </#if> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> /> Modified: struts/struts2/trunk/core/src/main/resources/template/simple/label.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/label.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/label.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/label.ftl Tue Aug 28 10:38:36 2007 @@ -37,6 +37,7 @@ for="${parameters.for?html}"<#rt/> </#if> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> ><#rt/> <#if parameters.nameValue?exists> <@s.property value="parameters.nameValue"/><#t/> Modified: struts/struts2/trunk/core/src/main/resources/template/simple/optgroup.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/optgroup.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/optgroup.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/optgroup.ftl Tue Aug 28 10:38:36 2007 @@ -30,6 +30,7 @@ <#if optGroupInternalListUiBean.parameters.disabled?default(false)> disabled="disabled" </#if> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> > <#list optGroupInternalListUiBean.parameters.list as optGroupBean> Modified: struts/struts2/trunk/core/src/main/resources/template/simple/password.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/password.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/password.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/password.ftl Tue Aug 28 10:38:36 2007 @@ -54,4 +54,5 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> /> Modified: struts/struts2/trunk/core/src/main/resources/template/simple/reset.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/reset.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/reset.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/reset.ftl Tue Aug 28 10:38:36 2007 @@ -36,6 +36,7 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl"/> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> ><#if parameters.label?exists><@s.property >value="parameters.label"/><#rt/></#if></button> <#else> <input type="reset"<#rt/> @@ -56,5 +57,6 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> /> </#if> Modified: struts/struts2/trunk/core/src/main/resources/template/simple/select.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/select.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/select.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/select.ftl Tue Aug 28 10:38:36 2007 @@ -49,6 +49,7 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> > <#if parameters.headerKey?exists && parameters.headerValue?exists> <option value="${parameters.headerKey?html}" Modified: struts/struts2/trunk/core/src/main/resources/template/simple/submit.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/submit.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/submit.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/submit.ftl Tue Aug 28 10:38:36 2007 @@ -45,6 +45,7 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl"/> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> ><#if parameters.body?length gt 0><@s.property >value="parameters.body"/><#elseif parameters.label?exists><@s.property >value="parameters.label"/><#rt/></#if></button> <#else> <#if parameters.type?exists && parameters.type=="image"> @@ -85,5 +86,6 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> /> </#if> Modified: struts/struts2/trunk/core/src/main/resources/template/simple/text.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/text.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/text.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/text.ftl Tue Aug 28 10:38:36 2007 @@ -54,4 +54,5 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> /> Modified: struts/struts2/trunk/core/src/main/resources/template/simple/textarea.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/textarea.ftl?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/textarea.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/textarea.ftl Tue Aug 28 10:38:36 2007 @@ -50,6 +50,7 @@ </#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> ><#rt/> <#if parameters.nameValue?exists> <@s.property value="parameters.nameValue"/><#t/> Modified: struts/struts2/trunk/core/src/site/resources/tags/ajax/a.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/ajax/a.html?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/site/resources/tags/ajax/a.html (original) +++ struts/struts2/trunk/core/src/site/resources/tags/ajax/a.html Tue Aug 28 10:38:36 2007 @@ -196,14 +196,6 @@ <td align="left" valign="top">Label expression used for rendering a element specific label</td> </tr> <tr> - <td align="left" valign="top">labelSeparator</td> - <td align="left" valign="top">false</td> - <td align="left" valign="top">:</td> - <td align="left" valign="top">true</td> - <td align="left" valign="top">String</td> - <td align="left" valign="top">String that will be appended to the labe</td> - </tr> - <tr> <td align="left" valign="top">labelposition</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> Modified: struts/struts2/trunk/core/src/site/resources/tags/ajax/autocompleter.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/ajax/autocompleter.html?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/site/resources/tags/ajax/autocompleter.html (original) +++ struts/struts2/trunk/core/src/site/resources/tags/ajax/autocompleter.html Tue Aug 28 10:38:36 2007 @@ -236,14 +236,6 @@ <td align="left" valign="top">Label expression used for rendering a element specific label</td> </tr> <tr> - <td align="left" valign="top">labelSeparator</td> - <td align="left" valign="top">false</td> - <td align="left" valign="top">:</td> - <td align="left" valign="top">true</td> - <td align="left" valign="top">String</td> - <td align="left" valign="top">String that will be appended to the labe</td> - </tr> - <tr> <td align="left" valign="top">labelposition</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> Modified: struts/struts2/trunk/core/src/site/resources/tags/ajax/datetimepicker.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/ajax/datetimepicker.html?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/site/resources/tags/ajax/datetimepicker.html (original) +++ struts/struts2/trunk/core/src/site/resources/tags/ajax/datetimepicker.html Tue Aug 28 10:38:36 2007 @@ -121,7 +121,7 @@ <td align="left" valign="top"></td> <td align="left" valign="top">true</td> <td align="left" valign="top">String</td> - <td align="left" valign="top">HTML id attribute</td> + <td align="left" valign="top">id for referencing element. For UI and form tags it will be used as HTML id attribute</td> </tr> <tr> <td align="left" valign="top">javascriptTooltip</td> @@ -146,14 +146,6 @@ <td align="left" valign="top">true</td> <td align="left" valign="top">String</td> <td align="left" valign="top">Label expression used for rendering a element specific label</td> - </tr> - <tr> - <td align="left" valign="top">labelSeparator</td> - <td align="left" valign="top">false</td> - <td align="left" valign="top">:</td> - <td align="left" valign="top">true</td> - <td align="left" valign="top">String</td> - <td align="left" valign="top">String that will be appended to the labe</td> </tr> <tr> <td align="left" valign="top">labelposition</td> Modified: struts/struts2/trunk/core/src/site/resources/tags/ajax/div.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/ajax/div.html?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/site/resources/tags/ajax/div.html (original) +++ struts/struts2/trunk/core/src/site/resources/tags/ajax/div.html Tue Aug 28 10:38:36 2007 @@ -212,14 +212,6 @@ <td align="left" valign="top">Label expression used for rendering a element specific label</td> </tr> <tr> - <td align="left" valign="top">labelSeparator</td> - <td align="left" valign="top">false</td> - <td align="left" valign="top">:</td> - <td align="left" valign="top">true</td> - <td align="left" valign="top">String</td> - <td align="left" valign="top">String that will be appended to the labe</td> - </tr> - <tr> <td align="left" valign="top">labelposition</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> Modified: struts/struts2/trunk/core/src/site/resources/tags/ajax/submit.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/ajax/submit.html?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/site/resources/tags/ajax/submit.html (original) +++ struts/struts2/trunk/core/src/site/resources/tags/ajax/submit.html Tue Aug 28 10:38:36 2007 @@ -204,14 +204,6 @@ <td align="left" valign="top">Label expression used for rendering a element specific label</td> </tr> <tr> - <td align="left" valign="top">labelSeparator</td> - <td align="left" valign="top">false</td> - <td align="left" valign="top">:</td> - <td align="left" valign="top">true</td> - <td align="left" valign="top">String</td> - <td align="left" valign="top">String that will be appended to the labe</td> - </tr> - <tr> <td align="left" valign="top">labelposition</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> Modified: struts/struts2/trunk/core/src/site/resources/tags/ajax/tabbedpanel.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/ajax/tabbedpanel.html?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/site/resources/tags/ajax/tabbedpanel.html (original) +++ struts/struts2/trunk/core/src/site/resources/tags/ajax/tabbedpanel.html Tue Aug 28 10:38:36 2007 @@ -132,14 +132,6 @@ <td align="left" valign="top">Label expression used for rendering a element specific label</td> </tr> <tr> - <td align="left" valign="top">labelSeparator</td> - <td align="left" valign="top">false</td> - <td align="left" valign="top">:</td> - <td align="left" valign="top">true</td> - <td align="left" valign="top">String</td> - <td align="left" valign="top">String that will be appended to the labe</td> - </tr> - <tr> <td align="left" valign="top">labelposition</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> Modified: struts/struts2/trunk/core/src/site/resources/tags/ajax/tree.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/ajax/tree.html?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/site/resources/tags/ajax/tree.html (original) +++ struts/struts2/trunk/core/src/site/resources/tags/ajax/tree.html Tue Aug 28 10:38:36 2007 @@ -220,14 +220,6 @@ <td align="left" valign="top">Label expression used for rendering a element specific label</td> </tr> <tr> - <td align="left" valign="top">labelSeparator</td> - <td align="left" valign="top">false</td> - <td align="left" valign="top">:</td> - <td align="left" valign="top">true</td> - <td align="left" valign="top">String</td> - <td align="left" valign="top">String that will be appended to the labe</td> - </tr> - <tr> <td align="left" valign="top">labelposition</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> Modified: struts/struts2/trunk/core/src/site/resources/tags/ajax/treenode.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/ajax/treenode.html?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/site/resources/tags/ajax/treenode.html (original) +++ struts/struts2/trunk/core/src/site/resources/tags/ajax/treenode.html Tue Aug 28 10:38:36 2007 @@ -92,14 +92,6 @@ <td align="left" valign="top">Label expression used for rendering tree node label.</td> </tr> <tr> - <td align="left" valign="top">labelSeparator</td> - <td align="left" valign="top">false</td> - <td align="left" valign="top">:</td> - <td align="left" valign="top">true</td> - <td align="left" valign="top">String</td> - <td align="left" valign="top">String that will be appended to the labe</td> - </tr> - <tr> <td align="left" valign="top">labelposition</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java?rev=570496&r1=570495&r2=570496&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java (original) +++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java Tue Aug 28 10:38:36 2007 @@ -28,7 +28,6 @@ */ public class AnchorTest extends AbstractUITagTest { - public void testSimple() throws Exception { TestAction testAction = (TestAction) action; testAction.setFoo("bar"); @@ -44,4 +43,21 @@ verify(AnchorTest.class.getResource("href-1.txt")); } + public void testDynamicAttribute() throws Exception { + TestAction testAction = (TestAction) action; + testAction.setFoo("bar"); + + AnchorTag tag = new AnchorTag(); + tag.setPageContext(pageContext); + + tag.setId("mylink"); + tag.setHref("a"); + + tag.setDynamicAttribute("uri", "dynAttrName", "dynAttrValue"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(AnchorTest.class.getResource("Anchor-2.txt")); + } } Added: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Anchor-2.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Anchor-2.txt?rev=570496&view=auto ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Anchor-2.txt (added) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Anchor-2.txt Tue Aug 28 10:38:36 2007 @@ -0,0 +1,5 @@ +<a + id="mylink" + href="a" + dynAttrName="dynAttrValue"> +</a>