You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by nb...@apache.org on 2003/07/22 07:28:12 UTC

cvs commit: jakarta-velocity-tools/src/java/org/apache/velocity/tools/struts StrutsUtils.java

nbubna      2003/07/21 22:28:12

  Modified:    src/java/org/apache/velocity/tools/struts StrutsUtils.java
  Log:
  add getActionMessages method
  
  Revision  Changes    Path
  1.3       +22 -15    jakarta-velocity-tools/src/java/org/apache/velocity/tools/struts/StrutsUtils.java
  
  Index: StrutsUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity-tools/src/java/org/apache/velocity/tools/struts/StrutsUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StrutsUtils.java	22 Mar 2003 20:33:09 -0000	1.2
  +++ StrutsUtils.java	22 Jul 2003 05:28:12 -0000	1.3
  @@ -72,6 +72,7 @@
   import org.apache.struts.util.MessageResources;
   
   
  +import org.apache.struts.Globals;
   import org.apache.struts.action.*;
   
   
  @@ -85,9 +86,9 @@
    * and reuse fostered.</p>
    *
    * <p>It is the aim, that sooner or later the functionality in
  - * this class is integrated into Struts itself.  Ideally, they will
  - * yank the JSP-centric code (PageContext, etc.) out of their RequestUtils 
  - * to allow other view layers to leverage that code.</p>
  + * this class is integrated into Struts itself.  See
  + * <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16814">Bug #16814</a>
  + * for more on that.</p>
    *
    * @author <a href="mailto:sidler@teamup.com">Gabe Sidler</a>, based
    * on code by <a href="mailto:ted@husted.org">Ted Husted</a>
  @@ -117,17 +118,6 @@
       }
   
   
  -    /* This method depends of features that are available in Struts 1.1+ only
  -    static ActionMessages getActionMessages(ServletContext application) 
  -    {
  -        if (application==null)
  -            return null;
  -        return (ActionMessages)
  -            application.getAttribute(Action.MESSAGE_KEY);
  -    }
  -    */
  -
  -
       /**
        * Returns the <code>org.apache.struts.action.ActionFormBeans</code> 
        * collection for this application or <code>null</code> if not found.
  @@ -344,6 +334,23 @@
           }
   
           return (ActionErrors) request.getAttribute(Action.ERROR_KEY);
  +    }
  +
  +
  +    /**
  +     * Returns the <code>org.apache.struts.action.ActionMessages</code> 
  +     * object for this request or <code>null</code> if none exists.
  +     *
  +     * @param request the servlet request
  +     */
  +    static ActionMessages getActionMessages(HttpServletRequest request)
  +    {
  +        if (request==null)
  +        {
  +            return null;
  +        }
  +
  +        return (ActionMessages) request.getAttribute(Globals.MESSAGE_KEY);
       }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org