Author: germuska
Date: Sun Nov  6 13:01:30 2005
New Revision: 331152

URL: http://svn.apache.org/viewcvs?rev=331152&view=rev
Log:
Change saveActionMessages to have more useful behavior.  Note that this 
specifically breaks previous (but unreleased) behavior, but as it was in the 
past, messages were being stored in the ActionContext itself, which doesn't 
seem like what most people would expect or find useful.  Now it saves the given 
messages under the given key in request scope.



Modified:
    
struts/core/trunk/src/java/org/apache/struts/chain/contexts/ActionContextBase.java

Modified: 
struts/core/trunk/src/java/org/apache/struts/chain/contexts/ActionContextBase.java
URL: 
http://svn.apache.org/viewcvs/struts/core/trunk/src/java/org/apache/struts/chain/contexts/ActionContextBase.java?rev=331152&r1=331151&r2=331152&view=diff
==============================================================================
--- 
struts/core/trunk/src/java/org/apache/struts/chain/contexts/ActionContextBase.java
 (original)
+++ 
struts/core/trunk/src/java/org/apache/struts/chain/contexts/ActionContextBase.java
 Sun Nov  6 13:01:30 2005
@@ -317,23 +317,34 @@
 
     /**
      * <p>
-     * Save the given ActionMessages this Context under key,
+     * Save the given ActionMessages into the request scope under the given 
key,
      * clearing the attribute if the messages are empty or null.
      * </p>
      * @param key The attribute name for the message cache
      * @param messages The ActionMessages to add
      */
     public void saveActionMessages(String key, ActionMessages messages) {
+        this.saveActionMessages(REQUEST_SCOPE, key, messages);
+    }
+
+    /**
+     * <p>Save the given <code>messages</code> into the map identified by the 
given <code>scopeId</code> under
+     * the given <code>key</code>.</p>
+     * @param scopeId
+     * @param key
+     * @param messages
+     */
+    public void saveActionMessages(String scopeId, String key, ActionMessages 
messages) {
+        Map scope = getScope(scopeId);
         if ((messages == null) || messages.isEmpty()) {
-            this.remove(key);
+            scope.remove(key);
             return;
         }
-        this.put(key, messages);
+        scope.put(key, messages);
     }
 
-
     // ISSUE: Should we deprecate this method, since it is misleading?
-    // Do we need it for backward compatability?
+    // Do we need it for backward compatibility?
 
     /**
      * <p>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to