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
>
>
> mschachter    01/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  Changes    Path
>   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. 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 <code>true</code> if the current multipart
> form's cancel button was
>   +     * pressed.  This method will check if the cancel
> button generated by
>   +     * <strong>CancelTag</strong> was pressed by the user in the
>   +     * current request.  If true, validation performed by an
>   +     * <strong>ActionForm</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 org.apache.struts.action.ValidatingActionForm
>   +     */
>   +    protected boolean isCancelled(MultipartRequestHandler
> request) {
>   +
>   +        Hashtable elements = request.getTextElements();
>   +        return ((elements.get(Constants.CANCEL_PROPERTY)
> != null) ||
>   +                (elements.get(Constants.CANCEL_PROPERTY_X)
> != null));
>        }
>
>
>
>
>
>   1.7       +7 -5
> jakarta-struts/src/share/org/apache/struts/action/ActionForm.java
>
>   Index: ActionForm.java
>   ===================================================================
>   RCS file:
> /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac
> tionForm.java,v
>   retrieving revision 1.6
>   retrieving revision 1.7
>   diff -u -r1.6 -r1.7
>   --- ActionForm.java 2001/02/21 00:35:43     1.6
>   +++ ActionForm.java 2001/05/11 17:10:58     1.7
>   @@ -1,7 +1,7 @@
>    /*
>   - * $Header:
> /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac
> tionForm.java,v 1.6 2001/02/21 00:35:43 craigmcc Exp $
>   - * $Revision: 1.6 $
>   - * $Date: 2001/02/21 00:35:43 $
>   + * $Header:
> /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Ac
> tionForm.java,v 1.7 2001/05/11 17:10:58 mschachter Exp $
>   + * $Revision: 1.7 $
>   + * $Date: 2001/05/11 17:10:58 $
>     *
>     *
> ====================================================================
>     *
>   @@ -94,7 +94,7 @@
>     * </p>
>     *
>     * @author Craig R. McClanahan
>   - * @version $Revision: 1.6 $ $Date: 2001/02/21 00:35:43 $
>   + * @version $Revision: 1.7 $ $Date: 2001/05/11 17:10:58 $
>     */
>
>    public abstract class ActionForm implements Serializable {
>   @@ -134,7 +134,9 @@
>         * The reasoning behind this is to give form bean developers
>         * control over the lifecycle of their multipart requests
>         * through the use of the finish() and/or rollback() methods
>   -     * of MultipartRequestHandler
>   +     * of MultipartRequestHandler.  This method will return
>   +     * <code>null</code> if this form's enctype is not
>   +     * "multipart/request-data".
>         * @see org.apache.struts.upload.MultipartRequestHandler
>         */
>        public MultipartRequestHandler getMultipartRequestHandler() {
>
>
>
>

Reply via email to