Index: core/src/main/java/org/apache/struts2/components/UIBean.java =================================================================== --- core/src/main/java/org/apache/struts2/components/UIBean.java (revision 450661) +++ core/src/main/java/org/apache/struts2/components/UIBean.java (working copy) @@ -158,6 +158,12 @@ * Object * define value of form element * + * + * key + * simple + * String + * The name of the property this input field represents. This will auto populate the name, label, and value + * * * * @@ -410,6 +416,9 @@ protected String templateDir; protected String theme; + // shortcut, sets label, name, and value + protected String key; + protected String cssClass; protected String cssStyle; protected String disabled; @@ -559,6 +568,21 @@ String name = null; + if (this.key != null) { + if(this.name == null) { + this.name = key; + } + + if(this.label == null) { + this.label = "%{getText('"+key +"')}"; + } + + if(this.value == null) { + this.value = "%{"+key +"}"; + } + } + + if (this.name != null) { name = findString(this.name); addParameter("name", name); @@ -1087,4 +1111,13 @@ public void setTooltipConfig(String tooltipConfig) { this.tooltipConfig = tooltipConfig; } + + /** + * Set the key (name, value, label) for this particular component + * @s.tagattribute required="false" type="String" default="" + */ + public void setKey(String key) { + this.key = key; + } + } Index: core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java =================================================================== --- core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java (revision 450661) +++ core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java (working copy) @@ -55,7 +55,8 @@ protected String onselect; protected String onchange; protected String accesskey; - + protected String key; + // tooltip attributes protected String tooltip; protected String tooltipConfig; @@ -97,6 +98,7 @@ uiBean.setTooltip(tooltip); uiBean.setTooltipConfig(tooltipConfig); uiBean.setAccesskey(accesskey); + uiBean.setKey(key); } public void setCssClass(String cssClass) { @@ -222,4 +224,8 @@ public void setAccesskey(String accesskey) { this.accesskey = accesskey; } + + public void setKey(String key) { + this.key = key; + } }