Re: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java
[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 ChangesPath 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 - 1.66 +++ Action.java 19 Aug 2003 23:20:45 - 1.67 @@ -431,15 +431,16 @@ } - /** * Save the specified messages keys into the appropriate request * attribute for use by the lt;html:messagesgt; 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. codenull/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:messagesgt; 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. codenull/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]
Re: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java
--- Robert Leland [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: David, I thought you were going to back this out ? The conversation was left with me proposing a solution and asking for Martin's thoughts on it. He hasn't responded so I haven't backed it out. Saving messages in the session is a commonly requested feature (and one that I need) so I think it needs a solution. Action.saveMessages() that saves them in the session is part of that solution. The other, is a class I wrote called SingleUseActionMessages that only returns its messages one time. I can commit SingleUseActionMessages if it's needed or we can come up with a better solution. David -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 ChangesPath 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.java2 Aug 2003 21:12:16 - 1.66 +++ Action.java19 Aug 2003 23:20:45 - 1.67 @@ -431,15 +431,16 @@ } - /** * Save the specified messages keys into the appropriate request * attribute for use by the lt;html:messagesgt; 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. codenull/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:messagesgt; 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. codenull/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] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java
David Graham wrote: --- Robert Leland [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: David, I thought you were going to back this out ? The conversation was left with me proposing a solution and asking for Martin's thoughts on it. He hasn't responded so I haven't backed it out. Saving messages in the session is a commonly requested feature (and one that I need) so I think it needs a solution. If the solution can automatically clean up after itself, no matter what scenario that is thrown at it, then I am +1. If there is *--any--* usecase where the session can be left with the messages still in the session, then I am -1. What ever goes into the session must be explicitly managed, which is usually handled from the struts-config.xml, such as the ActionForm lifecycle. -Rob Action.saveMessages() that saves them in the session is part of that solution. The other, is a class I wrote called SingleUseActionMessages that only returns its messages one time. I can commit SingleUseActionMessages if it's needed or we can come up with a better solution. David -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 ChangesPath 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 - 1.66 +++ Action.java 19 Aug 2003 23:20:45 - 1.67 @@ -431,15 +431,16 @@ } - /** * Save the specified messages keys into the appropriate request * attribute for use by the lt;html:messagesgt; 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. codenull/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:messagesgt; 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. codenull/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] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java
--- Robert Leland [EMAIL PROTECTED] wrote: David Graham wrote: --- Robert Leland [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: David, I thought you were going to back this out ? The conversation was left with me proposing a solution and asking for Martin's thoughts on it. He hasn't responded so I haven't backed it out. Saving messages in the session is a commonly requested feature (and one that I need) so I think it needs a solution. If the solution can automatically clean up after itself, no matter what scenario that is thrown at it, then I am +1. If there is *--any--* usecase where the session can be left with the messages still in the session, then I am -1. What ever goes into the session must be explicitly managed, which is usually handled from the struts-config.xml, such as the ActionForm lifecycle. I know of two options: 1. Add a remove attribute to html:messages so it will remove the messages when it's finished rendering. 2. Use something like SingleUseActionMessages which will remain in the session until overwritten but will only return messages once. Option 1 wasn't popular under the tags-shouldn't-alter-session-state philosophy. Option 2 does leave the messages in the session but they're harmless after the first use. I don't care which one we go with but storing messages in the session *is* a needed feature so we do need a solution. David -Rob Action.saveMessages() that saves them in the session is part of that solution. The other, is a class I wrote called SingleUseActionMessages that only returns its messages one time. I can commit SingleUseActionMessages if it's needed or we can come up with a better solution. David -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 ChangesPath 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 - 1.66 +++ Action.java 19 Aug 2003 23:20:45 - 1.67 @@ -431,15 +431,16 @@ } - /** * Save the specified messages keys into the appropriate request * attribute for use by the lt;html:messagesgt; 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. codenull/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:messagesgt; 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. codenull/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] __ Do you Yahoo!?
Re: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java
David Graham wrote: --- Robert Leland [EMAIL PROTECTED] wrote: David Graham wrote: --- Robert Leland [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: David, I thought you were going to back this out ? The conversation was left with me proposing a solution and asking for Martin's thoughts on it. He hasn't responded so I haven't backed it out. Saving messages in the session is a commonly requested feature (and one that I need) so I think it needs a solution. If the solution can automatically clean up after itself, no matter what scenario that is thrown at it, then I am +1. If there is *--any--* usecase where the session can be left with the messages still in the session, then I am -1. What ever goes into the session must be explicitly managed, which is usually handled from the struts-config.xml, such as the ActionForm lifecycle. I know of two options: 1. Add a remove attribute to html:messages so it will remove the messages when it's finished rendering. 2. Use something like SingleUseActionMessages which will remain in the session until overwritten but will only return messages once. Option 1 wasn't popular under the tags-shouldn't-alter-session-state philosophy. Option 2 does leave the messages in the session but they're harmless after the first use. I don't care which one we go with but storing messages in the session *is* a needed feature so we do need a solution. It is quite cear from what Martin stated that option 2 also does meet the requirements, nor mine. Until a satisfactory solution can be enginered the method needs to be removed* , now.* There have been two -1's on this. David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java
--- Martin Cooper [EMAIL PROTECTED] wrote: David, Perhaps you missed my -1 on providing a means of saving errors in session scope unless an *automatic* means of removing them at the appropriate time can also be provided. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21408 Indeed, sorry I missed that. The commit actually wasn't in response to that bug but filled a need I had. I often redirect to a success page to prevent the user from refreshing the page. Success messages should appear on the page I redirect to. So, I added the saveMessages() that saves to the session and I wrote a small subclass of ActionMessages that only displays the messages once. The object stays in the session until it's overwritten but the messages are never displayed again. I don't believe there's a way to remove them from the session so this solution seemed to be the best way. This is a rather common request from users and I could also add my SingleUseActionMessages to Struts if needed. Are you still -1 on this? If so, is there a better way of acheiving this functionality? David -- Martin Cooper [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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 ChangesPath 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 - 1.66 +++ Action.java 19 Aug 2003 23:20:45 - 1.67 @@ -431,15 +431,16 @@ } - /** * Save the specified messages keys into the appropriate request * attribute for use by the lt;html:messagesgt; 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. codenull/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:messagesgt; 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. codenull/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] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java
Are you changing all references from struts:whatever to html:whatever? Also, do you care about fixing the javadoc comments to reflect correct parameter names or is it a non-issue for now? (I know you're trying to get 1.1 ready) James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 12:11 AM To: [EMAIL PROTECTED] Subject: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java martinc 2002/06/30 21:10:38 Modified:src/share/org/apache/struts/action Action.java Log: Fixed in 20020701 nightly build. Revision ChangesPath 1.42 +6 -6 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.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- Action.java 25 Jun 2002 00:42:44 - 1.41 +++ Action.java 1 Jul 2002 04:10:38 - 1.42 @@ -645,7 +645,7 @@ /** * Save the specified error messages keys into the appropriate request - * attribute for use by the lt;struts:errorsgt; tag, if any messages + * attribute for use by the lt;html:errorsgt; tag, if any messages * are required. Otherwise, ensure that the request attribute is not * created. * @@ -669,7 +669,7 @@ /** * Save the specified messages keys into the appropriate request - * attribute for use by the lt;struts:messagesgt; tag (if + * attribute for use by the lt;html:messagesgt; tag (if * messages=true is set), if any messages are required. Otherwise, * ensure that the request attribute is not created. * -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java
Hal, It was my understanding that since isCancelled is a protected method in the Action class, that it was the Action developer's job to call the method. -Original Message- From: Deadman, Hal [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:24 PM To: [EMAIL PROTECTED] Subject: RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java Doesn't the Struts framework need to call this new method somewhere? The application code can't call the isCancelled method because the Action class code will never be called. If Struts ActionServlet calls the form validate when a user clicked cancel, the validation will likely fail and the user will be presented with the input form again. Clicking cancel needs to bypass the call to the form validate method. If that is done then the new isCancelled method may be used in the perform method. Hal -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:11 PM To: [EMAIL PROTECTED] Subject: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java mschachter01/05/11 10:11:06 Modified:doc todo-1.1.xml src/share/org/apache/struts/action Action.java ActionForm.java Log: - Add an isCancelled() method to the Action class that takes a MultipartRequestHandler as an argument. This should address issues with the html:cancel tag, as long as the new isCancelled method is called on for multipart forms. - Add myself to the EJB Design Pattern TODO Revision ChangesPath 1.3 +3 -0 jakarta-struts/doc/todo-1.1.xml Index: todo-1.1.xml === RCS file: /home/cvs/jakarta-struts/doc/todo-1.1.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- todo-1.1.xml2001/04/12 16:00:42 1.2 +++ todo-1.1.xml2001/05/11 17:10:47 1.3 @@ -159,6 +159,9 @@ assigned a href=mailto:[EMAIL PROTECTED];Nic Hobbs/a /assigned + assigned +a href=mailto:[EMAIL PROTECTED];Mike Schachter/a + /assigned /task task name=HTML No-Cache Support 1.20 +27 -4 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/Ac tion.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Action.java 2001/02/23 21:13:09 1.19 +++ Action.java 2001/05/11 17:10:55 1.20 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac tion.java,v 1.19 2001/02/23 21:13:09 craigmcc Exp $ - * $Revision: 1.19 $ - * $Date: 2001/02/23 21:13:09 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac tion.java,v 1.20 2001/05/11 17:10:55 mschachter Exp $ + * $Revision: 1.20 $ + * $Date: 2001/05/11 17:10:55 $ * * * @@ -67,6 +67,7 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; +import java.util.Hashtable; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; @@ -75,6 +76,7 @@ import javax.servlet.http.HttpSession; import org.apache.struts.taglib.html.Constants; import org.apache.struts.util.MessageResources; +import org.apache.struts.upload.MultipartRequestHandler; /** @@ -106,7 +108,7 @@ * by this Action. * * @author Craig R. McClanahan - * @version $Revision: 1.19 $ $Date: 2001/02/23 21:13:09 $ + * @version $Revision: 1.20 $ $Date: 2001/05/11 17:10:55 $ */ public class Action { @@ -466,6 +468,27 @@ return ((request.getParameter(Constants.CANCEL_PROPERTY) != null) || (request.getParameter(Constants.CANCEL_PROPERTY_X) != null)); +} + +/** + * Returns codetrue/code if the current multipart form's cancel button was + * pressed. This method will check if the cancel button generated by + * strongCancelTag/strong was pressed by the user in the + * current request. If true, validation performed by an + * strongActionForm/strong validate() method will have been + * skipped by the controller servlet. A MultipartRequestHandler instance + * can be obtained from a multipart form by calling + * {@link ActionForm#getMultipartRequestHandler() ActionForm.getMultipartRequestHandler()}. + * + * @param request The servlet request we are processing + * @see org.apache.struts.taglib.CancelTag + * @see
RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java
The developer should call isCancelled() but the check for the cancel tag in the request also exists in ActionServlet: protected boolean processValidate(ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Was this submit cancelled? if ((request.getParameter(Constants.CANCEL_PROPERTY) != null) || (request.getParameter(Constants.CANCEL_PROPERTY_X) != null)) { if (debug = 1) log( Cancelled transaction, no validation); return (true); } That check is done in order to avoid calling the validate function on the form if the cancel button was pressed. The action class perform method is then called and it is up to the developer to call isCancelled and return the appropriate forward. Hal -Original Message- From: SCHACHTER,MICHAEL (HP-NewJersey,ex2) [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:29 PM To: '[EMAIL PROTECTED]' Subject: RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java Hal, It was my understanding that since isCancelled is a protected method in the Action class, that it was the Action developer's job to call the method. -Original Message- From: Deadman, Hal [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:24 PM To: [EMAIL PROTECTED] Subject: RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java Doesn't the Struts framework need to call this new method somewhere? The application code can't call the isCancelled method because the Action class code will never be called. If Struts ActionServlet calls the form validate when a user clicked cancel, the validation will likely fail and the user will be presented with the input form again. Clicking cancel needs to bypass the call to the form validate method. If that is done then the new isCancelled method may be used in the perform method. Hal -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:11 PM To: [EMAIL PROTECTED] Subject: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java mschachter01/05/11 10:11:06 Modified:doc todo-1.1.xml src/share/org/apache/struts/action Action.java ActionForm.java Log: - Add an isCancelled() method to the Action class that takes a MultipartRequestHandler as an argument. This should address issues with the html:cancel tag, as long as the new isCancelled method is called on for multipart forms. - Add myself to the EJB Design Pattern TODO Revision ChangesPath 1.3 +3 -0 jakarta-struts/doc/todo-1.1.xml Index: todo-1.1.xml === RCS file: /home/cvs/jakarta-struts/doc/todo-1.1.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- todo-1.1.xml 2001/04/12 16:00:42 1.2 +++ todo-1.1.xml 2001/05/11 17:10:47 1.3 @@ -159,6 +159,9 @@ assigned a href=mailto:[EMAIL PROTECTED];Nic Hobbs/a /assigned + assigned +a href=mailto:[EMAIL PROTECTED];Mike Schachter/a + /assigned /task task name=HTML No-Cache Support 1.20 +27 -4 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/Ac tion.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Action.java 2001/02/23 21:13:09 1.19 +++ Action.java 2001/05/11 17:10:55 1.20 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac tion.java,v 1.19 2001/02/23 21:13:09 craigmcc Exp $ - * $Revision: 1.19 $ - * $Date: 2001/02/23 21:13:09 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac tion.java,v 1.20 2001/05/11 17:10:55 mschachter Exp $ + * $Revision: 1.20 $ + * $Date: 2001/05/11 17:10:55 $ * * * @@ -67,6 +67,7 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; +import java.util.Hashtable; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; @@ -75,6 +76,7 @@ import javax.servlet.http.HttpSession; import org.apache.struts.taglib.html.Constants; import
RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java
Is this an acceptable resolution to this problem for everybody? If so, I'll go ahead and fix the token problem in the Action class, be creating new isTokenValid() method that takes an HttpServletRequest and a MultipartRequestHandler as arguments, when using it for multipart forms. The other token methods don't need to be changed, as they only deal with retrieiving session information. -Original Message- From: SCHACHTER,MICHAEL (HP-NewJersey,ex2) [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:29 PM To: '[EMAIL PROTECTED]' Subject: RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java Hal, It was my understanding that since isCancelled is a protected method in the Action class, that it was the Action developer's job to call the method. -Original Message- From: Deadman, Hal [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:24 PM To: [EMAIL PROTECTED] Subject: RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java Doesn't the Struts framework need to call this new method somewhere? The application code can't call the isCancelled method because the Action class code will never be called. If Struts ActionServlet calls the form validate when a user clicked cancel, the validation will likely fail and the user will be presented with the input form again. Clicking cancel needs to bypass the call to the form validate method. If that is done then the new isCancelled method may be used in the perform method. Hal -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:11 PM To: [EMAIL PROTECTED] Subject: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java mschachter01/05/11 10:11:06 Modified:doc todo-1.1.xml src/share/org/apache/struts/action Action.java ActionForm.java Log: - Add an isCancelled() method to the Action class that takes a MultipartRequestHandler as an argument. This should address issues with the html:cancel tag, as long as the new isCancelled method is called on for multipart forms. - Add myself to the EJB Design Pattern TODO Revision ChangesPath 1.3 +3 -0 jakarta-struts/doc/todo-1.1.xml Index: todo-1.1.xml === RCS file: /home/cvs/jakarta-struts/doc/todo-1.1.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- todo-1.1.xml2001/04/12 16:00:42 1.2 +++ todo-1.1.xml2001/05/11 17:10:47 1.3 @@ -159,6 +159,9 @@ assigned a href=mailto:[EMAIL PROTECTED];Nic Hobbs/a /assigned + assigned +a href=mailto:[EMAIL PROTECTED];Mike Schachter/a + /assigned /task task name=HTML No-Cache Support 1.20 +27 -4 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/Ac tion.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Action.java 2001/02/23 21:13:09 1.19 +++ Action.java 2001/05/11 17:10:55 1.20 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac tion.java,v 1.19 2001/02/23 21:13:09 craigmcc Exp $ - * $Revision: 1.19 $ - * $Date: 2001/02/23 21:13:09 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac tion.java,v 1.20 2001/05/11 17:10:55 mschachter Exp $ + * $Revision: 1.20 $ + * $Date: 2001/05/11 17:10:55 $ * * * @@ -67,6 +67,7 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; +import java.util.Hashtable; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; @@ -75,6 +76,7 @@ import javax.servlet.http.HttpSession; import org.apache.struts.taglib.html.Constants; import org.apache.struts.util.MessageResources; +import org.apache.struts.upload.MultipartRequestHandler; /** @@ -106,7 +108,7 @@ * by this Action. * * @author Craig R. McClanahan - * @version $Revision: 1.19 $ $Date: 2001/02/23 21:13:09 $ + * @version $Revision: 1.20 $ $Date: 2001/05/11 17:10:55 $ */ public class Action { @@ -466,6 +468,27 @@ return ((request.getParameter(Constants.CANCEL_PROPERTY) != null) || (request.getParameter(Constants.CANCEL_PROPERTY_X) != null)); +} + +/** + * Returns codetrue/code if the current multipart form's cancel button
RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java
The controller servlet needs to correctly recognize a cancelled transaction, even on multi-part input, as Hal points out. The simplest approach is to update the logic in processValidate() that checks for cancellation so that it works in this case as well. Craig On Fri, 11 May 2001, SCHACHTER,MICHAEL (HP-NewJersey,ex2) wrote: Is this an acceptable resolution to this problem for everybody? If so, I'll go ahead and fix the token problem in the Action class, be creating new isTokenValid() method that takes an HttpServletRequest and a MultipartRequestHandler as arguments, when using it for multipart forms. The other token methods don't need to be changed, as they only deal with retrieiving session information. -Original Message- From: SCHACHTER,MICHAEL (HP-NewJersey,ex2) [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:29 PM To: '[EMAIL PROTECTED]' Subject: RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java Hal, It was my understanding that since isCancelled is a protected method in the Action class, that it was the Action developer's job to call the method. -Original Message- From: Deadman, Hal [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:24 PM To: [EMAIL PROTECTED] Subject: RE: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java Doesn't the Struts framework need to call this new method somewhere? The application code can't call the isCancelled method because the Action class code will never be called. If Struts ActionServlet calls the form validate when a user clicked cancel, the validation will likely fail and the user will be presented with the input form again. Clicking cancel needs to bypass the call to the form validate method. If that is done then the new isCancelled method may be used in the perform method. Hal -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 1:11 PM To: [EMAIL PROTECTED] Subject: cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java ActionForm.java mschachter01/05/11 10:11:06 Modified:doc todo-1.1.xml src/share/org/apache/struts/action Action.java ActionForm.java Log: - Add an isCancelled() method to the Action class that takes a MultipartRequestHandler as an argument. This should address issues with the html:cancel tag, as long as the new isCancelled method is called on for multipart forms. - Add myself to the EJB Design Pattern TODO Revision ChangesPath 1.3 +3 -0 jakarta-struts/doc/todo-1.1.xml Index: todo-1.1.xml === RCS file: /home/cvs/jakarta-struts/doc/todo-1.1.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- todo-1.1.xml 2001/04/12 16:00:42 1.2 +++ todo-1.1.xml 2001/05/11 17:10:47 1.3 @@ -159,6 +159,9 @@ assigned a href=mailto:[EMAIL PROTECTED];Nic Hobbs/a /assigned + assigned +a href=mailto:[EMAIL PROTECTED];Mike Schachter/a + /assigned /task task name=HTML No-Cache Support 1.20 +27 -4 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/Ac tion.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Action.java 2001/02/23 21:13:09 1.19 +++ Action.java 2001/05/11 17:10:55 1.20 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac tion.java,v 1.19 2001/02/23 21:13:09 craigmcc Exp $ - * $Revision: 1.19 $ - * $Date: 2001/02/23 21:13:09 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac tion.java,v 1.20 2001/05/11 17:10:55 mschachter Exp $ + * $Revision: 1.20 $ + * $Date: 2001/05/11 17:10:55 $ * * * @@ -67,6 +67,7 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; +import java.util.Hashtable; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; @@ -75,6 +76,7 @@ import javax.servlet.http.HttpSession; import org.apache.struts.taglib.html.Constants; import org.apache.struts.util.MessageResources; +import org.apache.struts.upload.MultipartRequestHandler; /** @@ -106,7 +108,7 @@ * by this Action. * * @author Craig R