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 2004/02/05 19:09:04 UTC

cvs commit: jakarta-servletapi-5/jsr152/examples/tagplugin choose.html choose.jsp foreach.html foreach.jsp howto.html if.html if.jsp notes.html

kinman      2004/02/05 10:09:04

  Modified:    jsr152/examples index.html
  Added:       jsr152/examples/WEB-INF tagPlugins.xml
               jsr152/examples/tagplugin choose.html choose.jsp
                        foreach.html foreach.jsp howto.html if.html if.jsp
                        notes.html
  Log:
  - Add examples, introductory notes, and a brief how-to notes for tag plugins.
  
  Revision  Changes    Path
  1.5       +46 -0     jakarta-servletapi-5/jsr152/examples/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/jakarta-servletapi-5/jsr152/examples/index.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- index.html	1 May 2003 22:39:53 -0000	1.4
  +++ index.html	5 Feb 2004 18:09:04 -0000	1.5
  @@ -308,5 +308,51 @@
   
   </table>
   
  +<br/>
  +<b><u><font size="+1">Tag Plugins</font></u></b><br>
  +<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
  +
  +<tr VALIGN=TOP>
  +  <td>If&nbsp;</td>
  +  <td VALIGN=TOP WIDTH="30%">
  +    <a href="tagplugin/if.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0  
  +align=TOP></a>
  +    <a href="tagplugin/if.jsp">Execute</a>
  +  </td>
  +  <td WIDTH="30%">
  +    <a href="tagplugin/if.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 hei
  +ght=24 width=24 align=TOP></a>
  +    <a href="tagplugin/if.html">Source</a>
  +  </td>
  +</tr>
  +
  +<tr VALIGN=TOP>
  +  <td>ForEach&nbsp;</td>
  +  <td VALIGN=TOP WIDTH="30%">
  +    <a href="tagplugin/foreach.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0  
  +align=TOP></a>
  +    <a href="tagplugin/foreach.jsp">Execute</a>
  +  </td>
  +  <td WIDTH="30%">
  +    <a href="tagplugin/foreach.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 hei
  +ght=24 width=24 align=TOP></a>
  +    <a href="tagplugin/foreach.html">Source</a>
  +  </td>
  +</tr>
  +
  +<tr VALIGN=TOP>
  +  <td>Choose&nbsp;</td>
  +  <td VALIGN=TOP WIDTH="30%">
  +    <a href="tagplugin/choose.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0  align=TOP></a>
  +    <a href="tagplugin/choose.jsp">Execute</a>
  +  </td>
  +  <td WIDTH="30%">
  +    <a href="tagplugin/choose.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a>
  +    <a href="tagplugin/choose.html">Source</a>
  +  </td>
  +</tr>
  +
  +</table>
  +
   </body>
   </html>
  
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/WEB-INF/tagPlugins.xml
  
  Index: tagPlugins.xml
  ===================================================================
  <tag-plugins>
    <tag-plugin>
      <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
      <plugin-class>org.apache.jasper.tagplugins.jstl.If</plugin-class>
    </tag-plugin>
    <tag-plugin>
      <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
      <plugin-class>org.apache.jasper.tagplugins.jstl.Choose</plugin-class>
    </tag-plugin>
    <tag-plugin>
      <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
      <plugin-class>org.apache.jasper.tagplugins.jstl.When</plugin-class>
    </tag-plugin>
    <tag-plugin>
      <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
      <plugin-class>org.apache.jasper.tagplugins.jstl.Otherwise</plugin-class>
    </tag-plugin>
    <tag-plugin>
      <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
      <plugin-class>org.apache.jasper.tagplugins.jstl.ForEach</plugin-class>
    </tag-plugin>
  </tag-plugins>
  
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/tagplugin/choose.html
  
  Index: choose.html
  ===================================================================
  <html>
  <head>
  <title>View Source Code</title>
  </head>
  
  <body bgcolor="#FFFFFF">
  <p><font color="#0000FF">
    <a href="choose.jsp">
      <img src="../images/execute.gif" align="right" border="0"></a>
    <a href="../index.html">
      <img src="../images/return.gif" width="24" height="24" align="right" border="0">
    </a></font>
  </p>
  
  <h3>
    <a href="choose.jsp.html">Source Code for choose.jsp<font color="#0000FF"/></a>
  </h3>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/tagplugin/choose.jsp
  
  Index: choose.jsp
  ===================================================================
  <html>
    <head>
      <title>Tag Examples - choose</title>
    </head>
    <body>
      <h1>Tag Plugin Examples - &lt;c:choose></h1>
  
      <hr>
      </br>
      <a href="notes.html">Plugin Introductory Notes<font <font color="#0000FF"></
  a>
      <br/>
      <a href="howto.html">Brief Instructions for Writing Plugins<font color="#000
  0
  FF"></a>
      <br/> <br/>
      <hr>
  
      <font color="#000000"/>
      </br>
  
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  
      <c:forEach var="index" begin="0" end="4">
        # ${index}: 
        <c:choose>
  	<c:when test="${index == 1}">
            One!</br>
  	</c:when>
  	<c:when test="${index == 4}">
            Four!</br>
  	</c:when>
  	<c:when test="${index == 3}">
            Three!</br>
  	</c:when>
  	<c:otherwise>
            Huh?</br>
  	</c:otherwise>
        </c:choose>
      </c:forEach>
    </body>
  </html> 
  
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/tagplugin/foreach.html
  
  Index: foreach.html
  ===================================================================
  <html>
  <head>
  <title>View Source Code</title>
  </head>
  
  <body bgcolor="#FFFFFF">
  <p><font color="#0000FF">
    <a href="foreach.jsp">
      <img src="../images/execute.gif" align="right" border="0"></a>
    <a href="../index.html">
      <img src="../images/return.gif" width="24" height="24" align="right" border="0">
    </a></font>
  </p>
  
  <h3>
    <a href="foreach.jsp.html">Source Code for foreach.jsp<font color="#0000FF"/></a>
  </h3>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/tagplugin/foreach.jsp
  
  Index: foreach.jsp
  ===================================================================
  <html>
    <head>
      <title>Tag Plugin Examples: forEach</title>
    </head>
    <body>
      <h1>Tag Plugin Examples - &lt;c:forEach></h1>
  
      <hr>
      </br>
      <a href="notes.html">Plugin Introductory Notes<font <font color="#0000FF"></
  a>
      <br/>
      <a href="howto.html">Brief Instructions for Writing Plugins<font color="#0000
  FF"></a>
      <br/> <br/>
      <hr>
  
      <font color="#000000"/>
      </br>
  
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
      <%@ page import="java.util.Vector" %>
  
      <h3>Iterating over a range</h3>
      <c:forEach var="item" begin="1" end="10">
          ${item}
      </c:forEach>
  
      <% Vector v = new Vector();
  	v.add("One"); v.add("Two"); v.add("Three"); v.add("Four");
  
  	pageContext.setAttribute("vector", v);
      %>
  
      <h3>Iterating over a Vector</h3>
  
      <c:forEach items="${vector}" var="item" >
  	${item}
      </c:forEach>
    </body>
  </html> 
  
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/tagplugin/howto.html
  
  Index: howto.html
  ===================================================================
  <html>
    <head>
      <title>Tag Plugin Implementation</title>
      <h2>How to write tag plugins</h2>
      <p>
        To write a plugin, you'll need to download the source for Tomcat 5.
        There are two steps:
      <ol>
        <li>
          Implement the plugin class.<p/>
          This class, which implements 
          <tt>org.apache.jasper.compiler.tagplugin.Plugin</tt>
          instructs Jasper what Java codes to generate in place of the tag
          handler calls.
          See Javadoc for <tt>org.apache.jasper.compiler.tagplugin.Plugin</tt>
          for details.
        </li>
  
        <li>
          Create the plugin descriptor file <tt> WEB-INF/tagPlugins.xml</tt><p/>
          This file
          specifies the plugin classes and their corresponding tag handler
          classes.
        </li>
      </ol>
    </head>
  </html>
  
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/tagplugin/if.html
  
  Index: if.html
  ===================================================================
  <html>
  <head>
  <title>View Source Code</title>
  </head>
  
  <body bgcolor="#FFFFFF">
  <p><font color="#0000FF">
    <a href="if.jsp">
      <img src="../images/execute.gif" align="right" border="0"></a>
    <a href="../index.html">
      <img src="../images/return.gif" width="24" height="24" align="right" border="0">
    </a></font>
  </p>
  
  <h3>
    <a href="if.jsp.html">Source Code for if.jsp<font color="#0000FF"/></a>
  </h3>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/tagplugin/if.jsp
  
  Index: if.jsp
  ===================================================================
  <html>
    <head>
      <title>Tag Plugin Examples: if</title>
    </head>
    <body>
      <h1>Tag Plugin Examples - &lt;c:if></h1>
  
      <hr>
      </br>
      <a href="notes.html">Plugin Introductory Notes<font <font color="#0000FF"></a>
      <br/>
      <a href="howto.html">Brief Instructions for Wrieting Plugins<font color="#0000FF"></a>
      <br/> <br/>
      <hr>
  
      <font color="#000000"/>
      </br>
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  
      <h3>Set the test result to a variable</h3>
      <c:if test="${1==1}" var="theTruth" scope="session"/>
      The result of testing for (1==1) is: ${theTruth}
  
      <h3>Conditionally execute the body</h3>
      <c:if test="${2>0}">
  	It's true that (2>0)!
      </c:if>
    </body>
  </html> 
  
  
  
  1.1                  jakarta-servletapi-5/jsr152/examples/tagplugin/notes.html
  
  Index: notes.html
  ===================================================================
  <html>
    <head>
      <title>Tag Plugin Introduction</title>
      <h2>Tag Plugins: Introductory Notes</h2>
      <p>
        Tomcat 5 provides a framework for implementing tag plugins.  The
        plugins instruct Jasper, at translation time, to replace tag handler
        calls with Java scriptlets.
        The framework allows tag library authors to implement plugins for
        their tags.
      </p>
      <p>
        Tomcat 5 is released with plugins for several JSTL tags.  Note
        that these plugins work with JSTL 1.1 as well as JSTL 1.0, though
        the examples uses JSTL 1.1 and JSP 2.0.  
        These plugins are not complete (for instance, some item types not
        handled in &lt;c:if>).
        They do serve as examples to show plugins in action (just
        examine the generated Java files), and how they can be implemented.
      </p>
    </head>
  </html>
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


RE: cvs commit: jakarta-servletapi-5/jsr152/examples/tagplugin choose.html choose.jsp foreach.html foreach.jsp howto.html if.html if.jsp notes.html

Posted by Ias <ia...@apache-korea.org>.
>   1.1                  
> jakarta-servletapi-5/jsr152/examples/tagplugin/howto.html
>   
>   Index: howto.html
>   ===================================================================
>   <html>
>     <head>
>       <title>Tag Plugin Implementation</title>
>       <h2>How to write tag plugins</h2>
>       <p>
>         To write a plugin, you'll need to download the source 
> for Tomcat 5.
>         There are two steps:
>       <ol>
>         <li>
>           Implement the plugin class.<p/>
>           This class, which implements 
>           <tt>org.apache.jasper.compiler.tagplugin.Plugin</tt>

I guess org.apache.jasper.compiler.tagplugin.TagPlugin is correct. 

Ias

=========================================================
Lee, Changshin (Korean name)
Ias (International name)
               Company Web Site: http://www.tmax.co.kr
               Personal Web Site: http://www.iasandcb.pe.kr
---------------------------------------------------------
JSR 201, 204, 222 and 224 EG member
Apache Axis (JAX-RPC and SAAJ) and JaxMe (JAXB) committer
R&D Center
Tmax Soft, Inc.
========================================================= 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org