nbubna      2004/11/10 16:52:15

  Modified:    src/java/org/apache/velocity/tools/struts StrutsUtils.java
  Log:
  support use of errors.prefix and errors.suffix for errorMarkup() (bug #31768, 
patch by Shinobu Kawai)
  
  Revision  Changes    Path
  1.24      +20 -3     
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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- StrutsUtils.java  14 Apr 2004 20:08:28 -0000      1.23
  +++ StrutsUtils.java  11 Nov 2004 00:52:15 -0000      1.24
  @@ -419,6 +419,8 @@
           StringBuffer results = new StringBuffer();
           String header = null;
           String footer = null;
  +        String prefix = null;
  +        String suffix = null;
           Locale locale = getLocale(request, session);
   
           MessageResources resources =
  @@ -427,6 +429,8 @@
           {
               header = resources.getMessage(locale, "errors.header");
               footer = resources.getMessage(locale, "errors.footer");
  +            prefix = resources.getMessage(locale, "errors.prefix");
  +            suffix = resources.getMessage(locale, "errors.suffix");
           }
           if (header == null)
           {
  @@ -436,6 +440,15 @@
           {
               footer = "errors.footer";
           }
  +        /* prefix or suffix are optional, be quiet if they're missing */
  +        if (prefix == null)
  +        {
  +            prefix = "";
  +        }
  +        if (suffix == null)
  +        {
  +            suffix = "";
  +        }
   
           results.append(header);
           results.append("\r\n");
  @@ -451,16 +464,20 @@
                                                  report.getKey(),
                                                  report.getValues());
               }
  +
  +            results.append(prefix);
  +
               if (message != null)
               {
                   results.append(message);
  -                results.append("\r\n");
               }
               else
               {
                   results.append(report.getKey());
  -                results.append("\r\n");
               }
  +
  +            results.append(suffix);
  +            results.append("\r\n");
           }
   
           results.append(footer);
  
  
  

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

Reply via email to