martinc     2003/03/03 20:43:44

  Modified:    src/share/org/apache/struts/taglib/html MessagesTag.java
  Log:
  Reset the 'processed' flag at the beginning of each usage of the tag. Use
  a local copy of the 'name' attribute to avoid modifying the attribute value
  itself.
  
  PR: 17613
  Submitted by: Larry Zappaterrini
  
  Revision  Changes    Path
  1.13      +22 -16    
jakarta-struts/src/share/org/apache/struts/taglib/html/MessagesTag.java
  
  Index: MessagesTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/MessagesTag.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- MessagesTag.java  28 Feb 2003 02:37:30 -0000      1.12
  +++ MessagesTag.java  4 Mar 2003 04:43:44 -0000       1.13
  @@ -228,9 +228,15 @@
        * @exception JspException if a JSP exception has occurred
        */
       public int doStartTag() throws JspException {
  +        // Initialize for a new request.
  +        processed = false;
  +
           // Were any messages specified?
           ActionMessages messages = null;
   
  +        // Make a local copy of the name attribute that we can modify.
  +        String name = this.name;
  +
           if (message != null && "true".equalsIgnoreCase(message)) {
               name = Globals.MESSAGE_KEY;
           }
  @@ -305,18 +311,18 @@
           }
   
           // Decide whether to iterate or quit
  -    if (iterator.hasNext()) {
  -           ActionMessage report = (ActionMessage)iterator.next();
  -           String msg = RequestUtils.message(pageContext, bundle,
  -                                             locale, report.getKey(),
  -                                             report.getValues());
  -
  -       pageContext.setAttribute(id, msg);
  -
  -       return (EVAL_BODY_TAG);
  -    } else {
  -       return (SKIP_BODY);
  -    }
  +        if (iterator.hasNext()) {
  +               ActionMessage report = (ActionMessage)iterator.next();
  +               String msg = RequestUtils.message(pageContext, bundle,
  +                                                 locale, report.getKey(),
  +                                                 report.getValues());
  +
  +           pageContext.setAttribute(id, msg);
  +
  +           return (EVAL_BODY_TAG);
  +        } else {
  +           return (SKIP_BODY);
  +        }
   
       }
   
  
  
  

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

Reply via email to