You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by hu...@apache.org on 2006/11/22 02:42:01 UTC

svn commit: r478007 - in /struts/struts2/trunk: apps/blank/src/main/resources/ apps/mailreader/src/main/webapp/ core/src/main/java/org/apache/struts2/components/ core/src/main/java/org/apache/struts2/dispatcher/mapper/

Author: husted
Date: Tue Nov 21 17:42:01 2006
New Revision: 478007

URL: http://svn.apache.org/viewvc?view=rev&rev=478007
Log:
WW-1458 Enable key attribute for submit and reset buttons.

Modified:
    struts/struts2/trunk/apps/blank/src/main/resources/struts.xml
    struts/struts2/trunk/apps/mailreader/src/main/webapp/Login.jsp
    struts/struts2/trunk/apps/mailreader/src/main/webapp/Registration.jsp
    struts/struts2/trunk/apps/mailreader/src/main/webapp/Subscription.jsp
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Reset.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Submit.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java

Modified: struts/struts2/trunk/apps/blank/src/main/resources/struts.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/blank/src/main/resources/struts.xml?view=diff&rev=478007&r1=478006&r2=478007
==============================================================================
--- struts/struts2/trunk/apps/blank/src/main/resources/struts.xml (original)
+++ struts/struts2/trunk/apps/blank/src/main/resources/struts.xml Tue Nov 21 17:42:01 2006
@@ -5,8 +5,8 @@
 
 <struts>
 
-    <constant name="struts.devMode" value="true" />
     <constant name="struts.enable.DynamicMethodInvocation" value="false" />
+    <constant name="struts.devMode" value="true" />
 
     <include file="example.xml"/>
 

Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/Login.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/Login.jsp?view=diff&rev=478007&r1=478006&r2=478007
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/Login.jsp (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/Login.jsp Tue Nov 21 17:42:01 2006
@@ -17,11 +17,11 @@
 
     <s:password key="password" showPassword="true"/>
 
-    <s:submit value="%{getText('button.save')}"/>
+    <s:submit key="button.save"/>
 
-    <s:reset value="%{getText('button.reset')}"/>
+    <s:reset key="button.reset"/>
 
-    <s:submit action="Login_cancel" value="%{getText('button.cancel')}"
+    <s:submit action="Login_cancel" key="button.cancel"
                 onclick="form.onsubmit=null"/>
 </s:form>
 

Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/Registration.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/Registration.jsp?view=diff&rev=478007&r1=478006&r2=478007
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/Registration.jsp (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/Registration.jsp Tue Nov 21 17:42:01 2006
@@ -42,19 +42,19 @@
                    name="user.replyToAddress"/>
 
     <s:if test="task == 'Create'">
-        <s:submit value="%{getText('button.save')}" action="Registration_save"/>
+        <s:submit key="button.save" action="Registration_save"/>
 
-        <s:reset value="%{getText('button.reset')}"/>
+        <s:reset key="button.reset"/>
 
-        <s:submit action="Welcome" value="%{getText('button.cancel')}"
+        <s:submit action="Welcome" key="button.cancel"
                     onclick="form.onsubmit=null"/>
     </s:if>
     <s:else>
-        <s:submit value="%{getText('button.save')}" action="Registration"/>
+        <s:submit key="button.save" action="Registration"/>
 
-        <s:reset value="%{getText('button.reset')}"/>
+        <s:reset key="button.reset"/>
 
-        <s:submit action="MainMenu" value="%{getText('button.cancel')}"
+        <s:submit action="MainMenu" key="button.cancel"
                     onclick="form.onsubmit=null"/>
     </s:else>
 

Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/Subscription.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/Subscription.jsp?view=diff&rev=478007&r1=478006&r2=478007
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/Subscription.jsp (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/Subscription.jsp Tue Nov 21 17:42:01 2006
@@ -42,7 +42,7 @@
                    name="subscription.type"/>
         <s:label key="autoConnect"
                    name="subscription.autoConnect"/>
-        <s:submit value="%{getText('button.confirm')}"/>
+        <s:submit key="button.confirm"/>
     </s:if>
     <s:else>
         <s:textfield key="mailUsername"
@@ -53,12 +53,12 @@
                     name="subscription.type" list="types"/>
         <s:checkbox key="autoConnect"
                       name="subscription.autoConnect"/>
-        <s:submit value="%{getText('button.save')}"/>
-        <s:reset value="%{getText('button.reset')}"/>
+        <s:submit key="button.save"/>
+        <s:reset key="button.reset"/>
     </s:else>
 
     <s:submit action="Registration_input"
-                value="%{getText('button.cancel')}"
+                key="button.cancel"
                 onclick="form.onsubmit=null"/>
 </s:form>
 

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=478007&r1=478006&r2=478007
==============================================================================
--- 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 Nov 21 17:42:01 2006
@@ -73,11 +73,16 @@
 
     public void evaluateParams() {
 
-        if (value == null) {
+        if ((key == null) && (value == null)) {
             value = "Reset";
         }
 
+        if (((key != null)) && (value == null)) {
+            this.value = "%{getText('"+key +"')}";
+        }
+
         super.evaluateParams();
+
     }
 
     /**

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?view=diff&rev=478007&r1=478006&r2=478007
==============================================================================
--- 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 Nov 21 17:42:01 2006
@@ -137,9 +137,14 @@
     }
 
     public void evaluateParams() {
-        if (value == null) {
+        if ((key == null) && (value == null)) {
             value = "Submit";
         }
+
+        if (((key != null)) && (value == null)) {
+            this.value = "%{getText('"+key +"')}";
+        }
+
         super.evaluateParams();
     }
 

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java?view=diff&rev=478007&r1=478006&r2=478007
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java Tue Nov 21 17:42:01 2006
@@ -44,8 +44,8 @@
  *      are specified using PARAM_NAME/PARAM_VALUE syntax.
  * </ul>
  * <p>
- * These two improvements allow a GET request for 'category/action/movie/Swingers' to
- * be mapped to the action name 'movie' with an id of 'Swingers' with an extra parameter
+ * These two improvements allow a GET request for 'category/action/movie/Thrillers' to
+ * be mapped to the action name 'movie' with an id of 'Thrillers' with an extra parameter
  * named 'category' with a value of 'action'.  A single action mapping can then handle
  * all CRUD operations using wildcards, e.g.
  * </p>
@@ -60,12 +60,12 @@
  * </p>
  * <ul>
  *  <li><code>GET:    /movie               => method="index"</code></li>
- *  <li><code>GET:    /movie/Swingers      => method="view", id="Swingers"</code></li>
- *  <li><code>GET:    /movie/Swingers!edit => method="edit", id="Swingers"</code></li>
+ *  <li><code>GET:    /movie/Thrillers      => method="view", id="Thrillers"</code></li>
+ *  <li><code>GET:    /movie/Thrillers!edit => method="edit", id="Thrillers"</code></li>
  *  <li><code>GET:    /movie/new           => method="editNew"</code></li>
- *  <li><code>POST:   /movie/Swingers      => method="update"</code></li>
+ *  <li><code>POST:   /movie/Thrillers      => method="update"</code></li>
  *  <li><code>PUT:    /movie/              => method="create"</code></li>
- *  <li><code>DELETE: /movie/Swingers      => method="remove"</code></li>
+ *  <li><code>DELETE: /movie/Thrillers      => method="remove"</code></li>
  * </ul>
  * <p>
  * To simulate the HTTP methods PUT and DELETE, since they aren't supported by HTML,