One problem we have with existing classes is the protected static log
variables.  If used by a subclass, you get a confusing log message that
points to the parent class.  Can you change this to private?

David


--- [EMAIL PROTECTED] wrote:
> sraeburn    2003/08/11 20:26:53
> 
>   Modified:    src/share/org/apache/struts/actions
> LocalStrings.properties
>   Added:       src/share/org/apache/struts/actions
>                         MappingDispatchAction.java
>   Log:
>   Addition of MappingDispatchAction that dispatches to a method named by
> the ActionMapping parameter
>   
>   PR: 17117 Suggested by Anthony Kay
>   
>   Revision  Changes    Path
>   1.7       +2 -0     
>
jakarta-struts/src/share/org/apache/struts/actions/LocalStrings.properties
>   
>   Index: LocalStrings.properties
>   ===================================================================
>   RCS file:
>
/home/cvs/jakarta-struts/src/share/org/apache/struts/actions/LocalStrings.properties,v
>   retrieving revision 1.6
>   retrieving revision 1.7
>   diff -u -r1.6 -r1.7
>   --- LocalStrings.properties 3 Jul 2003 03:14:14 -0000       1.6
>   +++ LocalStrings.properties 12 Aug 2003 03:26:53 -0000      1.7
>   @@ -10,3 +10,5 @@
>    include.rd=Cannot create request dispatcher for path {0}
>    switch.prefix=Invalid module prefix {0} was specified
>    switch.required=Switch requires both 'prefix' and 'page' request
> parameters
>   +success.required=SuccessAction could not find an ActionForward named
> 'success' for path '{0}'
>   +mapping.parameter=ActionMapping[{0}] does not define a 'parameter'
> attribute
>   \ No newline at end of file
>   
>   
>   
>   1.1                 
>
jakarta-struts/src/share/org/apache/struts/actions/MappingDispatchAction.java
>   
>   Index: MappingDispatchAction.java
>   ===================================================================
>   /*
>    * $Header$
>    * $Revision$
>    * $Date$
>    *
>    *
> ====================================================================
>    *
>    * The Apache Software License, Version 1.1
>    *
>    * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
>    * reserved.
>    *
>    * Redistribution and use in source and binary forms, with or without
>    * modification, are permitted provided that the following conditions
>    * are met:
>    *
>    * 1. Redistributions of source code must retain the above copyright
>    *    notice, this list of conditions and the following disclaimer.
>    *
>    * 2. Redistributions in binary form must reproduce the above
> copyright
>    *    notice, this list of conditions and the following disclaimer in
>    *    the documentation and/or other materials provided with the
>    *    distribution.
>    *
>    * 3. The end-user documentation included with the redistribution, if
>    *    any, must include the following acknowlegement:
>    *       "This product includes software developed by the
>    *        Apache Software Foundation (http://www.apache.org/)."
>    *    Alternately, this acknowlegement may appear in the software
> itself,
>    *    if and wherever such third-party acknowlegements normally
> appear.
>    *
>    * 4. The names "The Jakarta Project", "Struts", and "Apache Software
>    *    Foundation" must not be used to endorse or promote products
> derived
>    *    from this software without prior written permission. For written
>    *    permission, please contact [EMAIL PROTECTED]
>    *
>    * 5. Products derived from this software may not be called "Apache"
>    *    nor may "Apache" appear in their names without prior written
>    *    permission of the Apache Group.
>    *
>    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
>    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
>    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
>    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
>    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
>    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
>    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>    * SUCH DAMAGE.
>    *
> ====================================================================
>    *
>    * This software consists of voluntary contributions made by many
>    * individuals on behalf of the Apache Software Foundation.  For more
>    * information on the Apache Software Foundation, please see
>    * <http://www.apache.org/>.
>    *
>    */
>   
>   package org.apache.struts.actions;
>   
>   import javax.servlet.ServletException;
>   import javax.servlet.http.HttpServletRequest;
>   import javax.servlet.http.HttpServletResponse;
>   
>   import org.apache.commons.logging.Log;
>   import org.apache.commons.logging.LogFactory;
>   import org.apache.struts.action.ActionForm;
>   import org.apache.struts.action.ActionForward;
>   import org.apache.struts.action.ActionMapping;
>   
>   /**
>    * <p>An abstract <strong>Action</strong> that dispatches to a public
>    * method that is named by the <code>parameter</code> attribute of 
>    * the corresponding ActionMapping.  This is useful for developers who
> prefer
>    * to combine many related actions into a single Action class.</p>
>    *
>    * <p>To configure the use of this action in your
>    * <code>struts-config.xml</code> file, create an entry like this:</p>
>    *
>    * <pre><code>
>    *   &lt;action path="/saveSubscription"
>    *           type="org.example.SubscriptionAction"
>    *           name="subscriptionForm"
>    *          scope="request"
>    *          input="/subscription.jsp"
>    *      parameter="method"/&gt;
>    * </code></pre>
>    *
>    * <p>where 'method' is the name of a method in your subclass of
>    * MappingDispatchAction that has the same signature (other than
> method
>    * name) of the standard Action.execute method.  For example, you
> might combine
>    * the methods for managing a subscription into a  single 
>    * MappingDispatchAction class using the following methods:</p> 
>    * <ul>
>    * <li>public ActionForward create(ActionMapping mapping, ActionForm
> form,
>    *     HttpServletRequest request, HttpServletResponse response)
>    *     throws Exception</li>
>    * <li>public ActionForward edit(ActionMapping mapping, ActionForm
> form,
>    *     HttpServletRequest request, HttpServletResponse response)
>    *     throws Exception</li>
>    * <li>public ActionForward save(ActionMapping mapping, ActionForm
> form,
>    *     HttpServletRequest request, HttpServletResponse response)
>    *     throws Exception</li>
>    * <li>public ActionForward delete(ActionMapping mapping, ActionForm
> form,
>    *     HttpServletRequest request, HttpServletResponse response)
>    *     throws Exception</li>
>    * <li>public ActionForward list(ActionMapping mapping, ActionForm
> form,
>    *     HttpServletRequest request, HttpServletResponse response)
>    *     throws Exception</li>
>    * </ul>
>    * <p>for which you would create corresponding &lt;action&gt;
> configurations 
>    * that reference this class:</p>
>    *
>    * <pre><code>
>    *  &lt;action path="/createSubscription" 
>    *          type="org.example.SubscriptionAction"
>    *          parameter="create"&gt;
>    *      &lt;forward name="success" path="/editSubscription.jsp"/&gt;
>    *  &lt;/action&gt;
>    * 
>    *  &lt;action path="/editSubscription" 
>    *          type="org.example.Subscription"
>    *          parameter="edit"&gt;
>    *      &lt;forward name="success" path="/editSubscription.jsp"/&gt;
>    *  &lt;/action&gt;
>    *
>    *  &lt;action path="/saveSubscription" 
>    *          type="org.example.SubscriptionAction" 
>    *          parameter="save"
>    *          name="subscriptionForm" 
>    *          validate="true" 
>    *          input="/editSubscription.jsp" 
>    *          scope="request"&gt;
>    *      &lt;forward name="success" path="/savedSubscription.jsp"/&gt;
>    *  &lt;/action&gt;
>    *
>    *  &lt;action path="/deleteSubscription" 
>    *          type="org.example.SubscriptionAction"
>    *          name="subscriptionForm"
>    *          scope="request"
> 
=== message truncated ===


__________________________________
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]

Reply via email to