[EMAIL PROTECTED] wrote:

David,

I thought you were going to back this out ?

-Rob

dgraham 2003/08/19 16:20:46

 Modified:    src/share/org/apache/struts/action Action.java
 Log:
 Added version of saveMessages() that saves them into the session

instead of the request.
Revision Changes Path
1.67 +33 -8 jakarta-struts/src/share/org/apache/struts/action/Action.java
Index: Action.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Action.java,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- Action.java 2 Aug 2003 21:12:16 -0000 1.66
+++ Action.java 19 Aug 2003 23:20:45 -0000 1.67
@@ -431,15 +431,16 @@
}
-
/**
* Save the specified messages keys into the appropriate request
* attribute for use by the <html:messages> tag (if
* messages="true" is set), if any messages are required. Otherwise,
* ensure that the request attribute is not created.
*
- * @param request The servlet request we are processing
- * @param messages Messages object
+ * @param request The servlet request we are processing.
+ * @param messages The messages to save. <code>null</code> or empty + * messages removes any existing ActionMessages in the request.
+ * * @since Struts 1.1
*/
protected void saveMessages(
@@ -454,9 +455,33 @@
// Save the messages we need
request.setAttribute(Globals.MESSAGE_KEY, messages);
-
}
+ + /**
+ * Save the specified messages keys into the appropriate session
+ * attribute for use by the &lt;html:messages&gt; tag (if
+ * messages="true" is set), if any messages are required. Otherwise,
+ * ensure that the session attribute is not created.
+ *
+ * @param session The session to save the messages in.
+ * @param messages The messages to save. <code>null</code> or empty + * messages removes any existing ActionMessages in the session.
+ * + * @since Struts 1.2
+ */
+ protected void saveMessages(
+ HttpSession session,
+ ActionMessages messages) {
+
+ // Remove any messages attribute if none are required
+ if ((messages == null) || messages.isEmpty()) {
+ session.removeAttribute(Globals.MESSAGE_KEY);
+ return;
+ }
+ // Save the messages we need
+ session.setAttribute(Globals.MESSAGE_KEY, messages);
+ }
/**
* Save a new transaction token in the user's current session, creating


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








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



Reply via email to