struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject svn commit: r479263 - in /struts/struts2/trunk/core/src/main/java/org/apache/struts2/components: Label.java Reset.java TextField.java UIBean.java
Date Sun, 26 Nov 2006 03:13:07 GMT
Author: husted
Date: Sat Nov 25 19:13:06 2006
New Revision: 479263

URL: http://svn.apache.org/viewvc?view=rev&rev=479263
Log:
WW-1458 Enable use of both key and name attributes. Update some related Javadocs.

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Label.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/TextField.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java

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?view=diff&rev=479263&r1=479262&r2=479263
==============================================================================
--- 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 Sat Nov
25 19:13:06 2006
@@ -34,13 +34,18 @@
  * <p/> <b>Examples</b>
  * <p/>
  * <!-- START SNIPPET: exdescription -->
- * In this example, a label is rendered. The label is retrieved from a ResourceBundle by
calling ActionSupport's
- * getText() method giving you an output of 'User Name:tm_jee'. Assuming that i18n message
user_name corresponds
- * to 'User Name' and the action's getUserName() method returns 'tm_jee'<p/>
+ * In this example, a label is rendered. The label is retrieved from a ResourceBundle via
the key attribute
+ * giving you an output of 'User Name: Ford.Prefect'. Assuming that i18n message userName
corresponds
+ * to 'User Name' and the action's getUserName() method returns 'Ford.Prefect'<p/>
  * <!-- END SNIPPET: exdescription -->
  * <pre>
  * <!-- START SNIPPET: example -->
- * &lt;s:label label="%{text('user_name')}" name="userName" /&gt;
+ * &lt;s:label key="userName" /&gt;
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ * <pre>
+ * <!-- START SNIPPET: example2 -->
+ * &lt;s:label name="userName" label="User Name" /&gt;
  * <!-- END SNIPPET: example -->
  * </pre>
  *

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?view=diff&rev=479263&r1=479262&r2=479263
==============================================================================
--- 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 Sat Nov
25 19:13:06 2006
@@ -41,14 +41,14 @@
  *
  * <pre>
  * <!-- START SNIPPET: example -->
- * &lt;s:reset value="%{'Reset'}" /&gt;
+ * &lt;s:reset value="Reset" /&gt;
  * <!-- END SNIPPET: example -->
  * </pre>
  *
  * <pre>
  * <!-- START SNIPPET: example2 -->
  * Render an button reset:
- * &lt;s:reset type="button" value="%{'Reset'}" label="Reset the form"/&gt;
+ * &lt;s:reset type="button" key="reset"/&gt;
  * <!-- END SNIPPET: example2 -->
  * </pre>
  *

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?view=diff&rev=479263&r1=479262&r2=479263
==============================================================================
--- 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 Sat
Nov 25 19:13:06 2006
@@ -33,15 +33,20 @@
  * <p/> <b>Examples</b>
  * <p/>
  * <!-- START SNIPPET: exdescription -->
- * In this example, a text control is rendered. The label is retrieved from a ResourceBundle
by calling
- * ActionSupport's getText() method.<p/>
+ * In this example, a text control for the "user" property is rendered. The label is also
retrieved from a ResourceBundle via the key attribute.
  * <!-- END SNIPPET: exdescription -->
  * <pre>
  * <!-- START SNIPPET: example -->
- * &lt;s:textfield label="%{text('user_name')}" name="user" /&gt;
+ * &lt;s:textfield key="user" /&gt;
  * <!-- END SNIPPET: example -->
  * </pre>
  *
+ * <pre>
+ * <!-- START SNIPPET: example2 -->
+ * &lt;s:textfield name="user" label="User Name" /&gt;
+ * <!-- END SNIPPET: example -->
+ * </pre>
+
  * @s.tag name="textfield" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.TextFieldTag"
  * description="Render an HTML input field of type text"
  */

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?view=diff&rev=479263&r1=479262&r2=479263
==============================================================================
--- 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 Sat
Nov 25 19:13:06 2006
@@ -590,19 +590,16 @@
         String name = null;
 
         if (this.key != null) {
+
            if(this.name == null) {
                 this.name = key;
             }
 
             if(this.label == null) {
-                this.label = "%{getText('"+key +"')}";
+                this.label = "%{getText('"+ key +"')}";
             }
 
-            if(this.value == null) {
-                this.value = "%{"+key +"}";
-            }
         }
-
 
         if (this.name != null) {
             name = findString(this.name);



Mime
View raw message