You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2002/10/28 18:45:44 UTC

cvs commit: jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext JspFragment.java TagVariableInfo.java

kinman      2002/10/28 09:45:44

  Modified:    jsr152/examples/WEB-INF/classes/jsp2/examples/simpletag
                        RepeatSimpleTag.java ShuffleSimpleTag.java
               jsr152/examples/WEB-INF/tags displayProducts.tag
               jsr152/src/share/javax/servlet/jsp/tagext JspFragment.java
                        TagVariableInfo.java
  Added:       jsr152/examples/WEB-INF/lib jstl.jar standard.jar
  Log:
  - Patch by Jan Leuhe
  
  attached is a patch for the jakarta-servletapi-5 repository including
  the following changes:
  
  - TagVariableInfo.java:
    * Removed constructor that takes the name of a fragment.
    * Removed getFragment().
    * Removed private field "fragment".
  
  - JspFragment.java:
    * Removed Map parameter from invoke().
  
  - Updated the "simpletag" and "tagfiles" examples accordingly.
  
  Please notice that the patch also requires adding JSTL to the
  examples.war webapp. This is required because this webapp's tag files
  need to use JSTL's <c:set> action to set scoped variables before
  fragment invocations, now that <jsp:invoke> and <jsp:doBody> no longer
  have a nested <jsp:param>.
  
  Revision  Changes    Path
  1.2       +2 -3      jakarta-servletapi-5/jsr152/examples/WEB-INF/classes/jsp2/examples/simpletag/RepeatSimpleTag.java
  
  Index: RepeatSimpleTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-servletapi-5/jsr152/examples/WEB-INF/classes/jsp2/examples/simpletag/RepeatSimpleTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RepeatSimpleTag.java	7 Sep 2002 00:47:59 -0000	1.1
  +++ RepeatSimpleTag.java	28 Oct 2002 17:45:43 -0000	1.2
  @@ -18,10 +18,9 @@
       private int num;
   
       public void doTag() throws JspException, IOException {
  -        HashMap params = new HashMap();
           for (int i=0; i<num; i++) {
  -            params.put( "count", String.valueOf( i + 1 ) );
  -	    getJspBody().invoke(null, params);
  +            jspContext.setAttribute("count", String.valueOf( i + 1 ) );
  +	    getJspBody().invoke(null);
           }
       }
   
  
  
  
  1.2       +18 -18    jakarta-servletapi-5/jsr152/examples/WEB-INF/classes/jsp2/examples/simpletag/ShuffleSimpleTag.java
  
  Index: ShuffleSimpleTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-servletapi-5/jsr152/examples/WEB-INF/classes/jsp2/examples/simpletag/ShuffleSimpleTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ShuffleSimpleTag.java	7 Sep 2002 00:47:59 -0000	1.1
  +++ ShuffleSimpleTag.java	28 Oct 2002 17:45:44 -0000	1.2
  @@ -23,34 +23,34 @@
       public void doTag() throws JspException, IOException {
           switch( (int)(Math.random() * 6) ) {
               case 0:
  -                fragment1.invoke( null, null );
  -                fragment2.invoke( null, null );
  -                fragment3.invoke( null, null );
  +                fragment1.invoke( null );
  +                fragment2.invoke( null );
  +                fragment3.invoke( null );
                   break;
               case 1:
  -                fragment1.invoke( null, null );
  -                fragment3.invoke( null, null );
  -                fragment2.invoke( null, null );
  +                fragment1.invoke( null );
  +                fragment3.invoke( null );
  +                fragment2.invoke( null );
                   break;
               case 2:
  -                fragment2.invoke( null, null );
  -                fragment1.invoke( null, null );
  -                fragment3.invoke( null, null );
  +                fragment2.invoke( null );
  +                fragment1.invoke( null );
  +                fragment3.invoke( null );
                   break;
               case 3:
  -                fragment2.invoke( null, null );
  -                fragment3.invoke( null, null );
  -                fragment1.invoke( null, null );
  +                fragment2.invoke( null );
  +                fragment3.invoke( null );
  +                fragment1.invoke( null );
                   break;
               case 4:
  -                fragment3.invoke( null, null );
  -                fragment1.invoke( null, null );
  -                fragment2.invoke( null, null );
  +                fragment3.invoke( null );
  +                fragment1.invoke( null );
  +                fragment2.invoke( null );
                   break;
               case 5:
  -                fragment3.invoke( null, null );
  -                fragment2.invoke( null, null );
  -                fragment1.invoke( null, null );
  +                fragment3.invoke( null );
  +                fragment2.invoke( null );
  +                fragment1.invoke( null );
                   break;
           }
       }
  
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/WEB-INF/lib/jstl.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/WEB-INF/lib/standard.jar
  
  	<<Binary file>>
  
  
  1.2       +22 -27    jakarta-servletapi-5/jsr152/examples/WEB-INF/tags/displayProducts.tag
  
  Index: displayProducts.tag
  ===================================================================
  RCS file: /home/cvs/jakarta-servletapi-5/jsr152/examples/WEB-INF/tags/displayProducts.tag,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- displayProducts.tag	9 Sep 2002 18:01:20 -0000	1.1
  +++ displayProducts.tag	28 Oct 2002 17:45:44 -0000	1.2
  @@ -2,47 +2,42 @@
      - Copyright (c) 2002 The Apache Software Foundation.  All rights 
      - reserved.
   --%>
  +<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
   <%@ attribute name="normalPrice" fragment="true" %>
  -  <%@ variable fragment="normalPrice" name-given="name" %>
  -  <%@ variable fragment="normalPrice" name-given="price" %>
   <%@ attribute name="onSale" fragment="true" %>
  -  <%@ variable fragment="onSale" name-given="name" %>
  -  <%@ variable fragment="onSale" name-given="origPrice" %>
  -  <%@ variable fragment="onSale" name-given="salePrice" %>
  +<%@ variable name-given="name" %>
  +<%@ variable name-given="price" %>
  +<%@ variable name-given="origPrice" %>
  +<%@ variable name-given="salePrice" %>
   
   <table border="1">
     <tr>
       <td> 
  -      <jsp:invoke fragment="normalPrice">
  -	<jsp:param name="name" value="Hand-held Color PDA"/>
  -	<jsp:param name="price" value="$298.86"/>
  -      </jsp:invoke>
  +      <c:set var="name" value="Hand-held Color PDA"/>
  +      <c:set var="price" value="$298.86"/>
  +      <jsp:invoke fragment="normalPrice"/>
       </td>
       <td> 
  -      <jsp:invoke fragment="onSale">
  -	<jsp:param name="name" value="4-Pack 150 Watt Light Bulbs"/>
  -	<jsp:param name="origPrice" value="$2.98"/>
  -	<jsp:param name="salePrice" value="$2.32"/>
  -      </jsp:invoke>
  +      <c:set var="name" value="4-Pack 150 Watt Light Bulbs"/>
  +      <c:set var="origPrice" value="$2.98"/>
  +      <c:set var="salePrice" value="$2.32"/>
  +      <jsp:invoke fragment="onSale"/>
       </td>
       <td> 
  -      <jsp:invoke fragment="normalPrice">
  -	<jsp:param name="name" value="Digital Cellular Phone"/>
  -	<jsp:param name="price" value="$68.74"/>
  -      </jsp:invoke>
  +      <c:set var="name" value="Digital Cellular Phone"/>
  +      <c:set var="price" value="$68.74"/>
  +      <jsp:invoke fragment="normalPrice"/>
       </td>
       <td> 
  -      <jsp:invoke fragment="normalPrice">
  -	<jsp:param name="name" value="Baby Grand Piano"/>
  -	<jsp:param name="price" value="$10,800.00"/>
  -      </jsp:invoke>
  +      <c:set var="name" value="Baby Grand Piano"/>
  +      <c:set var="price" value="$10,800.00"/>
  +      <jsp:invoke fragment="normalPrice"/>
       </td>
       <td> 
  -      <jsp:invoke fragment="onSale">
  -	<jsp:param name="name" value="Luxury Car w/ Leather Seats"/>
  -	<jsp:param name="origPrice" value="$23,980.00"/>
  -	<jsp:param name="salePrice" value="$21,070.00"/>
  -      </jsp:invoke>
  +      <c:set var="name" value="Luxury Car w/ Leather Seats"/>
  +      <c:set var="origPrice" value="$23,980.00"/>
  +      <c:set var="salePrice" value="$21,070.00"/>
  +      <jsp:invoke fragment="onSale"/>
       </td>
     </tr>
   </table>
  
  
  
  1.3       +3 -12     jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/JspFragment.java
  
  Index: JspFragment.java
  ===================================================================
  RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/JspFragment.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JspFragment.java	19 Aug 2002 16:29:51 -0000	1.2
  +++ JspFragment.java	28 Oct 2002 17:45:44 -0000	1.3
  @@ -70,10 +70,7 @@
    * capable of executing the defined fragment.
    * <p>
    * A tag handler can invoke the fragment zero or more times, or 
  - * pass it along to other tags, before returning.  JSP fragments accept 
  - * parameters from the invoker, which are exposed as Expression Language 
  - * variables to the JSP code that composes the fragment.  This allows the 
  - * tag handler to parameterize the body each time it is invoked.
  + * pass it along to other tags, before returning.
    * <p>
    * Note that tag library developers and page authors should not generate
    * JspFragment implementations manually.
  @@ -91,16 +88,10 @@
       /**
        * Executes the fragment and directs all output to the given Writer,
        * or the JspWriter returned by the getOut() method of the JspContext
  -     * associated with the fragment if out is null.  The method accepts a 
  -     * parameter map, containing the body-input parameters passed to the 
  -     * body by its invoker (e.g. a tag handler).
  +     * associated with the fragment if out is null.
        *
        * @param out The Writer to output the fragment to, or null if 
        *     output should be sent to JspContext.getOut().
  -     * @param params specifies the set of parameters to pass to the fragment.
  -     *     Keys in this map are parameter names, and the 
  -     *     values are parameter values.  This allows the invoker to 
  -     *     parameterize a fragment invocation.
        * @throws javax.servlet.jsp.JspException Thrown if an error occured
        *     while invoking this fragment.
        * @throws javax.servlet.jsp.SkipPageException Thrown if the page
  @@ -111,7 +102,7 @@
        * @throws java.io.IOException If there was an error writing to the 
        *     stream.
        */
  -    public void invoke( java.io.Writer out, java.util.Map params )
  +    public void invoke( java.io.Writer out )
           throws javax.servlet.jsp.JspException, java.io.IOException;
   
   }
  
  
  
  1.4       +0 -40     jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/TagVariableInfo.java
  
  Index: TagVariableInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/TagVariableInfo.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TagVariableInfo.java	11 Oct 2002 20:35:26 -0000	1.3
  +++ TagVariableInfo.java	28 Oct 2002 17:45:44 -0000	1.4
  @@ -90,30 +90,6 @@
       }
   
       /**
  -     * JSP 2.0 Constructor for TagVariableInfo
  -     *
  -     * @param nameGiven value of &lt;name-given&gt;
  -     * @param nameFromAttribute value of &lt;name-from-attribute&gt;
  -     * @param className value of &lt;variable-class&gt;
  -     * @param declare value of &lt;declare&gt;
  -     * @param scope value of &lt;scope&gt;
  -     * @param fragment value of &lt;fragment&gt;
  -     *
  -     * @since JSP2.0
  -     */
  -    public TagVariableInfo(
  -	    String nameGiven,
  -	    String nameFromAttribute,
  -	    String className,
  -	    boolean declare,
  -	    int scope,
  -	    String fragment) 
  -    {
  -	this( nameGiven, nameFromAttribute, className, declare, scope );
  -	this.fragment = fragment;
  -    }
  -			 
  -    /**
        * The body of the &lt;name-given&gt; element
        *
        * @return The variable name as a constant
  @@ -170,17 +146,6 @@
   	return scope;
       }
   
  -    /**
  -     * The body of the &lt;fragment&gt; element
  -     *
  -     * @return The fragment this variable is scoped to
  -     *
  -     * @since JSP2.0
  -     */
  -    public String getFragment() {
  -	return fragment;
  -    }
  -
   
       /*
        * private fields
  @@ -190,9 +155,4 @@
       private String   className;         // <class>
       private boolean  declare;           // <declare>
       private int      scope;             // <scope>
  -
  -    /*
  -     * additional private fields for JSP 2.0
  -     */
  -    private String   fragment;          // <fragment>
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>