craigmcc    01/06/01 11:58:48

  Modified:    doc      struts-html.xml
               src/share/org/apache/struts/util RequestUtils.java
               web/exercise-taglib index.jsp
               web/exercise-taglib/WEB-INF struts-config.xml
  Added:       web/exercise-taglib html-link.jsp
  Log:
  Port fixes for #1891 from the 1.0 branch.
  
  Revision  Changes    Path
  1.13      +4 -2      jakarta-struts/doc/struts-html.xml
  
  Index: struts-html.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/doc/struts-html.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- struts-html.xml   2001/05/29 18:05:56     1.12
  +++ struts-html.xml   2001/06/01 18:58:35     1.13
  @@ -1707,7 +1707,8 @@
                   to be the names of query parameters to be appended to the
                   <code>src</code> URL.  The value associated with each key
                   must be either a String or a String array representing the
  -                parameter value(s).  If a String array is specified, more than
  +                parameter value(s), or an object whose toString() method
  +                will be called.  If a String array is specified, more than
                   one value for the same query parameter name will be
                   created.</p>
   
  @@ -2172,7 +2173,8 @@
                   <p>As the <code>Map</code> is processed, the keys are assumed
                   to be the names of query parameters to be appended to the
                   hyperlink.  The value associated with each key must be either
  -                a String or a String array representing the parameter value(s).
  +                a String or a String array representing the parameter value(s),
  +                or an object whose toString() method will be called.
                   If a String array is specified, more than one value for the
                   same query parameter name will be created.</p>
   
  
  
  
  1.15      +14 -5     
jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java
  
  Index: RequestUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- RequestUtils.java 2001/05/12 22:35:43     1.14
  +++ RequestUtils.java 2001/06/01 18:58:39     1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v 1.14 
2001/05/12 22:35:43 craigmcc Exp $
  - * $Revision: 1.14 $
  - * $Date: 2001/05/12 22:35:43 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v 1.15 
2001/06/01 18:58:39 craigmcc Exp $
  + * $Revision: 1.15 $
  + * $Date: 2001/06/01 18:58:39 $
    *
    * ====================================================================
    *
  @@ -95,7 +95,7 @@
    * in the Struts controller framework.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.14 $ $Date: 2001/05/12 22:35:43 $
  + * @version $Revision: 1.15 $ $Date: 2001/06/01 18:58:39 $
    */
   
   public class RequestUtils {
  @@ -376,7 +376,7 @@
                       url.append(URLEncoder.encode(key));
                       url.append('=');
                       url.append(URLEncoder.encode((String) value));
  -                } else /* if (value instanceof String[]) */ {
  +                } else if (value instanceof String[]) {
                       String values[] = (String[]) value;
                       for (int i = 0; i < values.length; i++) {
                           if (!question) {
  @@ -388,6 +388,15 @@
                           url.append('=');
                           url.append(URLEncoder.encode(values[i]));
                       }
  +                } else /* Convert other objects to a string */ {
  +                    if (!question) {
  +                        url.append('?');
  +                        question = true;
  +                    } else
  +                        url.append('&');
  +                    url.append(URLEncoder.encode(key));
  +                    url.append('=');
  +                    url.append(URLEncoder.encode(value.toString()));
                   }
               }
   
  
  
  
  1.2       +1 -0      jakarta-struts/web/exercise-taglib/index.jsp
  
  Index: index.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/exercise-taglib/index.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- index.jsp 2001/03/07 04:50:54     1.1
  +++ index.jsp 2001/06/01 18:58:44     1.2
  @@ -22,6 +22,7 @@
   
   <h3>HTML Tags</h3>
   <ul>
  +<li><a href="html-link.jsp">&lt;html:link&gt;</a></li>
   <li><a href="html-multibox.jsp">&lt;html:multibox&gt;</a></li>
   <li><a href="html-select.jsp">&lt;html:select&gt;</a></li>
   <li><a href="html-setters.jsp">Scalar Setters</a></li>
  
  
  
  1.2       +144 -0    jakarta-struts/web/exercise-taglib/html-link.jsp
  
  
  
  
  1.4       +8 -0      jakarta-struts/web/exercise-taglib/WEB-INF/struts-config.xml
  
  Index: struts-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/exercise-taglib/WEB-INF/struts-config.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- struts-config.xml 2001/04/11 01:56:15     1.3
  +++ struts-config.xml 2001/06/01 18:58:47     1.4
  @@ -17,6 +17,14 @@
   
     <action-mappings>
   
  +    <action    path="/html-link"
  +               type="org.apache.struts.webapp.exercise.HtmlSettersAction"
  +               name="testbean"
  +              scope="session"
  +           validate="false">
  +      <forward name="input"                path="/html-link.jsp"/>
  +    </action>
  +
       <action    path="/html-multibox"
                  type="org.apache.struts.webapp.exercise.HtmlSettersAction"
                  name="testbean"
  
  
  

Reply via email to