You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ted Husted <ne...@husted.com> on 2001/02/20 13:36:47 UTC

[Fwd: cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/html ImageTag.java ImgTag.java]

Anyone who is using the HTML Image tag should note the following.

See also <
http://www.mail-archive.com/struts-dev%40jakarta.apache.org/msg00443.html
>

------- Original Message --------

From: craigmcc@apache.org
Subject: cvs commit:
jakarta-struts/src/share/org/apache/struts/taglib/html ImageTag.java
ImgTag.java
To: jakarta-struts-cvs@apache.org

craigmcc    01/02/19 18:59:00

  Modified:    src/doc  struts-html.xml
               src/share/org/apache/struts/taglib/html ImageTag.java
                        ImgTag.java
  Log:
  Retrofit the <html:image> tag so that it offers the same support for
  dynamically looking up alternate text, context-relative URIs, or
source
  URLs in a message resources bundle that the <html:img> tag has.
  
  NOTE:  This change is *not* backwards compatible, but the changes are
very
  easy:
  * Change any use of 'src="foo" isKey="true"' to 'srcKey="foo"' instead
  * Change any use of 'path="/foo"' to 'page="/foo"' instead
  
  Revision  Changes    Path
  1.14      +144 -74   jakarta-struts/src/doc/struts-html.xml
  
  Index: struts-html.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/doc/struts-html.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- struts-html.xml	2001/02/20 01:48:44	1.13
  +++ struts-html.xml	2001/02/20 02:58:59	1.14
  @@ -1251,165 +1251,235 @@
   
           </tag>
   
  -      <tag> 
  -          <name>image</name>
  -          <summary>
  -                Renders an input of type "image"
  -          </summary>
  -          <tagclass>org.apache.struts.taglib.html.ImageTag</tagclass>
  -          <info>
  -                This tag renders an input of type "image".  Use the
"src" attribute
  -                in conjunction with a non-null "isKey" attribute to
retrieve a
  -                property value from a resource bundle.  Use the
"path"
  -                attribute to specify a direct path to the image.  See
info on
  -                the "property" attribute if you would like to obtain
the coordinates
  -                of the mouse click submitted with the request.
  -          </info>
  -          <attribute> 
  -            <name>locale</name> 
  -            <required>false</required> 
  -            <rtexprvalue>true</rtexprvalue> 
  -            <info>
  -                The locale to use to retrieve the key specified by
"src".
  -            </info>
  -          </attribute> 
  -          <attribute> 
  -            <name>bundle</name> 
  -            <required>false</required> 
  -            <rtexprvalue>true</rtexprvalue>
  -            <info>
  -                The servlet context attribute key for the
MessageResources
  -                instance to use.
  -            </info>
  -          </attribute> 
  -          <attribute> 
  -            <name>accesskey</name> 
  -            <required>false</required> 
  -            <rtexprvalue>true</rtexprvalue> 
  -          </attribute> 
  +        <tag> 
  +                <name>image</name>
  +                <summary>
  +                Render an input tag of type "image"
  +                </summary>
  +               
<tagclass>org.apache.struts.taglib.html.ImageTag</tagclass>
  +                <info>
  +
  +                <p>Renders an HTML <code>&lt;input&gt;</code> tag of
type
  +                "image".  The base URL for this image is calculated
directly
  +                based on the value specified in the <code>src</code>
or
  +                <code>page</code> attributes, or indirectly by
looking up a
  +                message resource string based on the
<code>srcKey</code> or
  +                <code>pageKey</code> attributes.  You
<strong>must</strong>
  +                specify exactly one of these attributes.</p>
  +
  +                <p>If you would like to obtain the coordinates of the
mouse
  +                click that submitted this request, see the
information below
  +                on the <code>property</code> attribute.</p>
  +
  +                </info>
  +
  +        <attribute> 
  +                <name>accesskey</name> 
  +                <required>false</required> 
  +                <rtexprvalue>true</rtexprvalue> 
  +                <info>
  +                <p>The keyboard character used to move focus
immediately
  +                to this element.</p>
  +                </info>
  +        </attribute> 
  +
  +        <attribute>
  +                <name>alt</name>
  +                <required>false</required>
  +                <rtexprvalue>true</rtexprvalue>
  +                <info>
  +                <p>The alternate text for this image.</p>
  +                </info>
  +        </attribute>
  +
  +        <attribute>
  +                <name>altKey</name>
  +                <required>false</required>
  +                <rtexprvalue>true</rtexprvalue>
  +                <info>
  +                <p>The message resources key of the alternate text
for this
  +                image.</p>
  +                </info>
  +        </attribute>
  +
  +        <attribute> 
  +                <name>bundle</name> 
  +                <required>false</required> 
  +                <rtexprvalue>true</rtexprvalue>
  +                <info>
  +                <p>The servlet context attribute key for the
MessageResources
  +                instance to use.  If not specified, defaults to the
  +                application resources configured for our action
servlet.</p>
  +                </info>
  +        </attribute> 
  +
  +        <attribute> 
  +                <name>locale</name> 
  +                <required>false</required> 
  +                <rtexprvalue>true</rtexprvalue> 
  +                <info>
  +                <p>The session attribute key for the Locale used to
select
  +                internationalized messages.  If not specified,
defaults to the
  +                Struts standard value.</p>
  +                </info>
  +        </attribute> 
  +
             <attribute> 
               <name>onblur</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onchange</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onclick</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>ondblclick</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onfocus</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onkeydown</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onkeypress</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onkeyup</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onmousedown</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onmousemove</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onmouseout</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onmouseover</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>onmouseup</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute>
  -          <attribute> 
  -            <name>property</name> 
  -            <required>false</required> 
  -            <rtexprvalue>true</rtexprvalue>
  -            <info>
  -                The name of this image tag.  The parameter names for
the request
  -                will appear as "property.x" and "property.y", the x
and y
  -                representing the coordinates of the mouse click for
the image.
  -                A way of retrieving these values through a form bean
is to
  -                define getX(), getY(), setX(), and setY() methods,
and specify
  -                your propery as a blank string (property="").
  -          </info>
  -          </attribute>
  -          <attribute> 
  -            <name>src</name> 
  -            <required>true</required> 
  -            <rtexprvalue>true</rtexprvalue> 
  -            <info>
  -                The "src" attribute of the input tag, or if "isKey"
is not null,
  -                the key of the bundle value to use for this
attribute.
  -            </info>
  -          </attribute> 
  +
  +        <attribute>
  +                <name>page</name>
  +                <required>false</required>
  +                <rtexprvalue>true</rtexprvalue>
  +                <info>
  +                <p>The context-relative path of the image for this
  +                input tag.</p>
  +                </info>
  +        </attribute>
  +
  +        <attribute>
  +                <name>pageKey</name>
  +                <required>false</required>
  +                <rtexprvalue>true</rtexprvalue>
  +                <info>
  +                <p>The key of the message resources string specifying
the
  +                context-relative path of the image for this input
tag.</p> 
  +                </info>
  +        </attribute>
  +
  +        <attribute> 
  +                <name>property</name> 
  +                <required>false</required> 
  +                <rtexprvalue>true</rtexprvalue>
  +                <info>
  +                <p>The property name of this image tag.  The
parameter names
  +                for the request will appear as "property.x" and
"property.y",
  +                the x and y representing the coordinates of the mouse
click
  +                for the image.  A way of retrieving these values
through a
  +                form bean is to define getX(), getY(), setX(), and
setY()
  +                methods, and specify your propery as a blank string
  +                (property="").</p>
  +                </info>
  +        </attribute>
  +
  +        <attribute> 
  +                <name>src</name> 
  +                <required>false</required> 
  +                <rtexprvalue>true</rtexprvalue> 
  +                <info>
  +                <p>The source URL of the image for this input
tag.</p>
  +                </info>
  +        </attribute> 
  +
  +        <attribute>
  +                <name>srcKey</name>
  +                <required>false</required>
  +                <rtexprvalue>true</rtexprvalue>
  +                <info>
  +                <p>The key of the message resources string specifying
the
  +                source URL of the image for this input tag.</p>
  +                </info>
  +        </attribute>
  +
             <attribute> 
               <name>style</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>styleClass</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>tabindex</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
             </attribute> 
  +
             <attribute> 
               <name>value</name> 
               <required>false</required> 
               <rtexprvalue>true</rtexprvalue> 
  -          </attribute> 
  -          <attribute> 
  -            <name>path</name> 
  -            <required>false</required> 
  -            <rtexprvalue>true</rtexprvalue> 
  -            <info>
  -                The path of image for image button.
  -            </info>
  -          </attribute> 
  -          <attribute> 
  -            <name>isKey</name> 
  -            <required>false</required> 
  -            <rtexprvalue>true</rtexprvalue>
  -            <info>
  -                Whether or not the "src" attribute represents a
ResourceBundle key.
  -            </info>
             </attribute> 
  +
           </tag> 
   
   
  
  
  
  1.4       +214 -148 
jakarta-struts/src/share/org/apache/struts/taglib/html/ImageTag.java
  
  Index: ImageTag.java
  ===================================================================
  RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImageTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ImageTag.java	2001/01/08 21:36:06	1.3
  +++ ImageTag.java	2001/02/20 02:59:00	1.4
  @@ -1,13 +1,13 @@
   /*
  - * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImageTag.java,v
1.3 2001/01/08 21:36:06 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/01/08 21:36:06 $
  + * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImageTag.java,v
1.4 2001/02/20 02:59:00 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/02/20 02:59:00 $
    *
    *
====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All
rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -29,7 +29,7 @@
    *    Alternately, this acknowlegement may appear in the software
itself,
    *    if and wherever such third-party acknowlegements normally
appear.
    *
  - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
  + * 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 apache@apache.org.
  @@ -66,18 +66,22 @@
   import java.lang.reflect.Method;
   import java.io.IOException;
   import java.util.Locale;
  +import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpServletResponse;
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.PageContext;
   import javax.servlet.jsp.JspWriter;
   import org.apache.struts.action.Action;
   import org.apache.struts.util.MessageResources;
  +import org.apache.struts.util.RequestUtils;
  +import org.apache.struts.util.ResponseUtils;
   
   
   /**
    * Tag for input fields of type "image".
    *
    * @author Oleg V Alexeev
  - * @version $Revision: 1.3 $ $Date: 2001/01/08 21:36:06 $
  + * @version $Revision: 1.4 $ $Date: 2001/02/20 02:59:00 $
    */
   
   public class ImageTag extends SubmitTag {
  @@ -87,173 +91,138 @@
   
   
       /**
  -     * The source of image for image button.
  -     */
  -    protected String src = null;
  -
  -    /**
  -     * The path of image for image button.
  -     */
  -    protected String path = null;
  -    
  -    /**
  -     * The name attribute for the image button
  -     */
  -    protected String property = "";
  -
  -    /**
  -     * If not null - src property will
  -     * treated as key to retrieve string 
  -     * from message bundle.
  -     */
  -    protected String isKey = null;
  -
  -    /**
  -     * The servlet context attribute key for our resources.
  -     */
  -    protected String bundle = Action.MESSAGES_KEY;
  -
  -
  -    /**
        * The default Locale for our server.
        */
       protected static final Locale defaultLocale =
Locale.getDefault();
   
   
  -    /**
  -     * The session scope key under which our Locale is stored.
  -     */
  -    protected String localeKey = Action.LOCALE_KEY;
  -
       // -------------------------------------------------------------
Properties
   
       
       /**
  -     * Return the property.
  +     * The alternate text for this image.
        */
  -    public String getProperty() {
  +    protected String alt = null;
   
  -	return (this.property);
  +    public String getAlt() {
  +        return (this.alt);
  +    }
   
  +    public void setAlt(String alt) {
  +        this.alt = alt;
       }
   
   
       /**
  -     * Set the property name.
  -     *
  -     * @param property The property name
  +     * The message resources key for the alternate text for this
image.
        */
  -    public void setProperty(String property) {
  -   
  -	this.property = property;
  +    protected String altKey = null;
  +
  +    public String getAltKey() {
  +        return (this.altKey);
  +    }
   
  +    public void setAltKey(String altKey) {
  +        this.altKey = null;
       }
   
  +
       /**
  -     * Return the bundle key.
  +     * The servlet context attribute key for our resources.
        */
  -    public String getBundle() {
  +    protected String bundle = Action.MESSAGES_KEY;
   
  +    public String getBundle() {
           return (this.bundle);
  -
       }
   
  -
  -    /**
  -     * Set the bundle key.
  -     *
  -     * @param bundle The new bundle key.
  -     */
       public void setBundle(String bundle) {
  -
           this.bundle = bundle;
  -
       }
   
  +
       /**
  -     * Return the locale key.
  +     * The session attribute key for our locale.
        */
  -    public String getLocale() {
  +    protected String locale = Action.LOCALE_KEY;
   
  -        return (this.localeKey);
  -
  +    public String getLocale() {
  +        return (this.locale);
       }
   
  -
  -    /**
  -     * Set the locale key.
  -     *
  -     * @param locale The new locale key
  -     */
       public void setLocale(String locale) {
  -
  -        this.localeKey = locale;
  -
  +        this.locale = locale;
       }
   
  +
       /**
  -     * Return the src of image.
  +     * The context-relative URI of the image.
        */
  -    public String getSrc() {
  +    protected String page = null;
   
  -        return (this.src);
  +    public String getPage() {
  +        return (this.page);
  +    }
   
  +    public void setPage(String page) {
  +        this.page = page;
       }
   
   
       /**
  -     * Set the image src.
  -     *
  -     * @param value The image src.
  +     * The message resources key of the context-relative URI of the
image.
        */
  -    public void setSrc(String src) {
  -
  -        this.src = src;
  +    protected String pageKey = null;
   
  +    public String getPageKey() {
  +        return (this.pageKey);
       }
  -
  -    /**
  -     * Return the path of image.
  -     */
  -    public String getPath() {
   
  -        return (this.path);
  -
  +    public void setPageKey(String pageKey) {
  +        this.pageKey = pageKey;
       }
   
   
       /**
  -     * Set the image path.
  -     *
  -     * @param value The image path.
  +     * The name attribute for the image button.
        */
  -    public void setPath(String path) {
  +    protected String property = "";
   
  -        this.path = path;
  +    public String getProperty() {
  +	return (this.property);
  +    }
   
  +    public void setProperty(String property) {
  +	this.property = property;
       }
   
  +
       /**
  -     * Return the isKey.
  +     * The URL of this image.
        */
  -    public String getIsKey() {
  +    protected String src = null;
   
  -        return (this.isKey);
  +    public String getSrc() {
  +        return (this.src);
  +    }
   
  +    public void setSrc(String src) {
  +        this.src = src;
       }
   
   
       /**
  -     * Set the isKey value.
  -     *
  -     * @param value The isKey switcher.
  +     * The message resources key for the URL of this image.
        */
  -    public void setIsKey(String isKey) {
  -
  -        this.isKey = isKey;
  +    protected String srcKey = null;
   
  +    public String getSrcKey() {
  +        return (this.srcKey);
       }
   
  +    public void setSrcKey(String srcKey) {
  +        this.srcKey = srcKey;
  +    }
   
   
       // ---------------------------------------------------------
Public Methods
  @@ -279,42 +248,30 @@
        */
       public int doEndTag() throws JspException {
   
  -        if( isKey!=null ) {
  -          MessageResources resources = (MessageResources)
  -             pageContext.getAttribute( bundle,
PageContext.APPLICATION_SCOPE);
  -          if (resources == null)
  -             throw new JspException
  -                (messages.getMessage("messageTag.resources",
bundle));
  -          Locale locale = null;
  -          try {
  -              locale = (Locale)
  -                  pageContext.getAttribute( localeKey,
PageContext.SESSION_SCOPE);
  -          } catch (IllegalStateException e) {     // Invalidated
session
  -              locale = null;
  -          }
  -          if (locale == null)
  -              locale = defaultLocale;
  -          src = resources.getMessage( locale, src);
  -          if( src==null )
  -           src = "";
  -        }
  -
  -        // Acquire the alt label value we will be generating
  -        String alt = value;
  -        if ((alt== null) && (bodyContent != null))
  -            alt = bodyContent.getString().trim();
  -        if ((alt == null) || (alt.length() < 1))
  -            alt = "Submit";
  -
  -        // Generate an HTML element
  +        // Generate an HTML <input type="image"> element
  +        HttpServletResponse response =
  +            (HttpServletResponse) pageContext.getResponse();
  +        String tmp = null;
           StringBuffer results = new StringBuffer();
           results.append("<input type=\"image\" name=\"");
           results.append(property);
  -        results.append("\" alt=\"");
  -        results.append(alt);
  -        results.append("\" value=\"");
  -        results.append(value);
  -        results.append("\"");
  +        tmp = src();
  +        if (tmp != null) {
  +            results.append(" src=\"");
  +           
results.append(response.encodeURL(ResponseUtils.filter(tmp)));
  +            results.append("\"");
  +        }
  +        tmp = alt();
  +        if (tmp != null) {
  +            results.append(" alt=\"");
  +            results.append(tmp);
  +            results.append("\"");
  +        }
  +        if (value != null) {
  +            results.append(" value=\"");
  +            results.append(value);
  +            results.append("\"");
  +        }
           if (accesskey != null) {
               results.append(" accesskey=\"");
               results.append(accesskey);
  @@ -325,24 +282,16 @@
               results.append(tabindex);
               results.append("\"");
           }
  -        results.append(" src=\"");
  -        if( path != null )
  -         results.append(path);         
  -        results.append(src);
  -        results.append("\"");
           results.append(prepareEventHandlers());
           results.append(prepareStyles());
           results.append(">");
   
           // Render this element to our writer
  -        JspWriter writer = pageContext.getOut();
  -        try {
  -            writer.print(results.toString());
  -        } catch (IOException e) {
  -            throw new JspException
  -                (messages.getMessage("common.io", e.toString()));
  -        }
  +        ResponseUtils.write(pageContext, results.toString());
  +
  +        // Evaluate the remainder of this page
           return (EVAL_PAGE);
  +
       }
   
   
  @@ -352,7 +301,124 @@
       public void release() {
   
           super.release();
  -        src = "submit";
  +        alt = null;
  +        altKey = null;
  +        bundle = Action.MESSAGES_KEY;
  +        locale = Action.LOCALE_KEY;
  +        page = null;
  +        pageKey = null;
  +        property = "";
  +        src = null;
  +        srcKey = null;
  +
  +    }
  +
  +
  +    // ------------------------------------------------------
Protected Methods
  +
  +
  +    /**
  +     * Return the alternate text to be included on this generated
element,
  +     * or <code>null</code> if there is no such text.
  +     *
  +     * @exception JspException if an error occurs
  +     */
  +    protected String alt() throws JspException {
  +
  +        if (this.alt != null) {
  +            if (this.altKey != null) {
  +                JspException e = new JspException
  +                    (messages.getMessage("imgTag.alt"));
  +                RequestUtils.saveException(pageContext, e);
  +                throw e;
  +            } else {
  +                return (this.alt);
  +            }
  +        } else if (this.altKey != null) {
  +            MessageResources resources = (MessageResources)
  +                pageContext.getAttribute(this.bundle,
  +                                        
PageContext.APPLICATION_SCOPE);
  +            if (resources == null) {
  +                JspException e = new JspException
  +                    (messages.getMessage("imgTag.bundle",
this.bundle));
  +                throw e;
  +            }
  +            Locale locale = null;
  +            try {
  +                locale = (Locale)
  +                    pageContext.getAttribute(this.locale,
  +                                            
PageContext.SESSION_SCOPE);
  +            } catch (IllegalStateException e) {
  +                locale = null; // Invalidated session
  +            }
  +            if (locale == null)
  +                locale = defaultLocale;
  +            return (resources.getMessage(locale, this.altKey));
  +        } else {
  +            return (null);
  +        }
  +
  +    }
  +
  +
  +    /**
  +     * Return the base source URL that will be rendered in the
<code>src</code>
  +     * property for this generated element, or <code>null</code> if
there is
  +     * no such URL.
  +     *
  +     * @exception JspException if an error occurs
  +     */
  +    protected String src() throws JspException {
  +
  +        // Deal with a direct context-relative page that has been
specified
  +        if (this.page != null) {
  +            if ((this.src != null) || (this.srcKey != null) ||
  +                (this.pageKey != null)) {
  +                JspException e = new JspException
  +                    (messages.getMessage("imgTag.src"));
  +                RequestUtils.saveException(pageContext, e);
  +                throw e;
  +            }
  +            HttpServletRequest request =
  +                (HttpServletRequest) pageContext.getRequest();
  +            return (request.getContextPath() + this.page);
  +        }
  +
  +        // Deal with an indirect context-relative page that has been
specified
  +        if (this.pageKey != null) {
  +            if ((this.src != null) || (this.srcKey != null)) {
  +                JspException e = new JspException
  +                    (messages.getMessage("imgTag.src"));
  +                RequestUtils.saveException(pageContext, e);
  +                throw e;
  +            }
  +            HttpServletRequest request =
  +                (HttpServletRequest) pageContext.getRequest();
  +            return (request.getContextPath() +
  +                    RequestUtils.message(pageContext, bundle,
  +                                         locale, this.pageKey));
  +        }
  +
  +        // Deal with an absolute source that has been specified
  +        if (this.src != null) {
  +            if (this.srcKey != null) {
  +                JspException e = new JspException
  +                    (messages.getMessage("imgTag.src"));
  +                RequestUtils.saveException(pageContext, e);
  +                throw e;
  +            }
  +            return (this.src);
  +        }
  +
  +        // Deal with an indirect source that has been specified
  +        if (this.srcKey == null) {
  +            JspException e = new JspException
  +                (messages.getMessage("imgTag.src"));
  +            RequestUtils.saveException(pageContext, e);
  +            throw e;
  +        }
  +        return (RequestUtils.message(pageContext, bundle,
  +                                     locale, this.srcKey));
   
       }
   
  
  
  
  1.7       +10 -15   
jakarta-struts/src/share/org/apache/struts/taglib/html/ImgTag.java
  
  Index: ImgTag.java
  ===================================================================
  RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImgTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ImgTag.java	2001/02/20 01:48:46	1.6
  +++ ImgTag.java	2001/02/20 02:59:00	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImgTag.java,v
1.6 2001/02/20 01:48:46 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/02/20 01:48:46 $
  + * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImgTag.java,v
1.7 2001/02/20 02:59:00 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/02/20 02:59:00 $
    *
    *
====================================================================
    *
  @@ -79,6 +79,7 @@
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.PropertyUtils;
   import org.apache.struts.util.RequestUtils;
  +import org.apache.struts.util.ResponseUtils;
   
   
   /**
  @@ -96,7 +97,7 @@
    *
    * @author Michael Westbay
    * @author Craig McClanahan
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   
   public class ImgTag extends BaseHandlerTag {
  @@ -509,13 +510,14 @@
           String srcurl = url(tmp);
           if (srcurl != null) {
               results.append(" src=\"");
  -           
results.append(response.encodeURL(BeanUtils.filter(srcurl)));
  +           
results.append(response.encodeURL(ResponseUtils.filter(srcurl)));
               results.append("\"");
           }
           String lowsrcurl = url(this.lowsrc);
           if (lowsrcurl != null) {
               results.append(" lowsrc=\"");
  -           
results.append(response.encodeURL(BeanUtils.filter(lowsrcurl)));
  +            results.append
  +               
(response.encodeURL(ResponseUtils.filter(lowsrcurl)));
               results.append("\"");
           }
           tmp = alt();
  @@ -574,16 +576,9 @@
   	results.append(">");
   
   	// Print this element to our output writer
  -	JspWriter writer = pageContext.getOut();
  -	try {
  -	    writer.print(results.toString());
  -	} catch (IOException e) {
  -            pageContext.setAttribute(Action.EXCEPTION_KEY, e,
  -                                     PageContext.REQUEST_SCOPE);
  -	    throw new JspException
  -		(messages.getMessage("common.io", e.toString()));
  -	}
  +        ResponseUtils.write(pageContext, results.toString());
   
  +        // Evaluate the reaminder of this page
   	return (EVAL_PAGE);
   
       }